Browse Source

Pull request #1803: 无jira任务, release/10.0 合 bugfix/10.0

Merge in DESIGN/design from release/10.0 to bugfix/10.0

* commit 'cbe384f48f1c71cb927cea1518de63c63ef0c815': (63 commits)
  CHART-14541 轴标题增加缩进
  REPORT-34020 【国际化】非简中设计器-界面右侧面板选择超链接或悬浮元素后下拉框溢出
  CHART-14120 英文设计器地图数据面板截断
  REPORT-33236
  REPORT-31546 公式面板的说明切换偶尔会失效
  REPORT-34351 ""改为StringUtils.EMPTY
  REPORT-33500 日志面板清除日志后同时清除设计器右上角日志提示信息
  REPORT-35016【组件生成】目前生成的组件,从组件库拖入模板中会变大 [场景] 从组件库拖入时,不会保持原有的大小。 [解决方案] 将原来的大小,在创建时一并初始化
  CHART-14346
  CHART-14346 悬浮窗图表组合图不允许选择单元格数据源
  REPORT-34954 富文本上标下标不应该可以同时设置
  REPORT-34954 富文本上标下标可以同时设置
  CHART-14180  优化代码
  CHART-14346 && CHART-14180  悬浮图表配置组合图不能选择单元格数据源 && 轴标题隐藏优化
  REPORT-34385 修改联网搜索的enable条件
  REPORT-34351 修正FineJOptionPane组件showInputDialog()方法点击弹出框的取消键后的行为;在组件重命名后将与自己的原来的名字进行对比的情况去除
  REPORT-34385 enabled4Locale与isSearchOnLine条件合并
  REPORT-34385 在alphafine设置窗口打开的时候,将联网搜索状态与几个相关选项的状态进行关联
  REPORT-29573 【国际化】插件管理类别、场景部分仍显示中文
  REPORT-34222 报表设计器给容器插件开个复制粘贴的接口 改下参数
  ...
bugfix/10.0
ju.ju 4 years ago
parent
commit
1604f2b76f
  1. 14
      designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineConfigPane.java
  2. 29
      designer-base/src/main/java/com/fr/design/data/datapane/connect/JDBCDefPane.java
  3. 6
      designer-base/src/main/java/com/fr/design/dialog/FineJOptionPane.java
  4. 20
      designer-base/src/main/java/com/fr/design/extra/exe/GetPluginCategoriesExecutor.java
  5. 45
      designer-base/src/main/java/com/fr/design/formula/FormulaPane.java
  6. 25
      designer-base/src/main/java/com/fr/design/mainframe/chart/info/ChartInfo.java
  7. 17
      designer-base/src/main/java/com/fr/design/mainframe/chart/info/ChartInfoCollector.java
  8. 1
      designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogHandlerBar.java
  9. 6
      designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogMessageBar.java
  10. 6
      designer-base/src/main/java/com/fr/design/utils/gui/GUICoreUtils.java
  11. 1
      designer-base/src/main/java/com/fr/start/server/FineEmbedServerActivator.java
  12. 15
      designer-chart/src/main/java/com/fr/design/chart/AutoChartDialog.java
  13. 2
      designer-chart/src/main/java/com/fr/design/chart/AutoChartIcon.java
  14. 120
      designer-chart/src/main/java/com/fr/design/chart/AutoChartTypePane.java
  15. 18
      designer-chart/src/main/java/com/fr/design/chart/ChartDialog.java
  16. 143
      designer-chart/src/main/java/com/fr/design/chart/auto/AutoTypeCalculate.java
  17. 26
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypePane.java
  18. 1
      designer-chart/src/main/java/com/fr/van/chart/custom/VanChartCustomDataPane.java
  19. 19
      designer-chart/src/main/java/com/fr/van/chart/custom/VanChartCustomPlotDataContentsTabPane.java
  20. 44
      designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartBaseAxisPane.java
  21. 8
      designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartTimeAxisPane.java
  22. 2
      designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartValueAxisPane.java
  23. 10
      designer-chart/src/main/java/com/fr/van/chart/map/designer/data/contentpane/table/VanPointMapPlotTableDataContentPane.java
  24. 2
      designer-form/src/main/java/com/fr/design/designer/beans/models/SelectionModel.java
  25. 53
      designer-form/src/main/java/com/fr/design/mainframe/ShareWidgetButton.java
  26. 38
      designer-form/src/test/java/com/fr/design/mainframe/ShareWidgetButtonTest.java
  27. 10
      designer-realize/src/main/java/com/fr/design/cell/editor/RichTextToolBar.java
  28. 2
      designer-realize/src/main/java/com/fr/design/mainframe/SheetNameTabPane.java
  29. 17
      designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellFormulaQuickEditor.java

14
designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineConfigPane.java

@ -192,29 +192,29 @@ public class AlphaFineConfigPane extends BasicPane {
this.enabledCheckbox.setSelected(alphaFineConfigManager.isEnabled());
boolean enabled4Locale = FRContext.isChineseEnv();
boolean enabled4Locale = FRContext.isChineseEnv() && alphaFineConfigManager.isSearchOnLine();
this.searchOnlineCheckbox.setEnabled(enabled4Locale);
this.searchOnlineCheckbox.setSelected(alphaFineConfigManager.isSearchOnLine());
this.searchOnlineCheckbox.setEnabled(FRContext.isChineseEnv());
this.searchOnlineCheckbox.setSelected(enabled4Locale);
this.containActionCheckbox.setSelected(alphaFineConfigManager.isContainAction());
this.containTemplateCheckbox.setSelected(alphaFineConfigManager.isContainTemplate());
this.containFileContentCheckbox.setSelected(alphaFineConfigManager.isContainFileContent());
this.containDocumentCheckbox.setSelected(alphaFineConfigManager.isContainDocument() && alphaFineConfigManager.isSearchOnLine());
this.containDocumentCheckbox.setSelected(alphaFineConfigManager.isContainDocument() && enabled4Locale);
this.containDocumentCheckbox.setEnabled(enabled4Locale);
this.containPluginCheckbox.setSelected(alphaFineConfigManager.isContainPlugin() && alphaFineConfigManager.isSearchOnLine());
this.containPluginCheckbox.setSelected(alphaFineConfigManager.isContainPlugin() && enabled4Locale);
this.containPluginCheckbox.setEnabled(enabled4Locale);
this.containRecommendCheckbox.setSelected(alphaFineConfigManager.isContainRecommend() && alphaFineConfigManager.isSearchOnLine());
this.containRecommendCheckbox.setSelected(alphaFineConfigManager.isContainRecommend() && enabled4Locale);
this.containRecommendCheckbox.setEnabled(enabled4Locale);
this.shortcutsField.setText(getDisplayShortCut(alphaFineConfigManager.getShortcuts()));
this.needSegmentationCheckbox.setSelected(alphaFineConfigManager.isNeedSegmentationCheckbox());
this.needIntelligentCustomerService.setSelected(alphaFineConfigManager.isNeedIntelligentCustomerService() && alphaFineConfigManager.isSearchOnLine());
this.needIntelligentCustomerService.setSelected(alphaFineConfigManager.isNeedIntelligentCustomerService() && enabled4Locale);
this.needIntelligentCustomerService.setEnabled(enabled4Locale);
shortCutKeyStore = convert2KeyStroke(alphaFineConfigManager.getShortcuts());

29
designer-base/src/main/java/com/fr/design/data/datapane/connect/JDBCDefPane.java

@ -1,5 +1,6 @@
package com.fr.design.data.datapane.connect;
import com.fr.base.GraphHelper;
import com.fr.design.constants.UIConstants;
import com.fr.data.impl.JDBCDatabaseConnection;
import com.fr.data.pool.DBCPConnectionPoolAttr;
@ -16,7 +17,9 @@ import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.dialog.BasicPane;
import com.fr.design.editor.editor.IntegerEditor;
import com.fr.design.utils.BrowseUtils;
import com.fr.file.filter.ChooseFileFilter;
import com.fr.general.CloudCenter;
import com.fr.general.ComparatorUtils;
import com.fr.stable.StringUtils;
@ -65,6 +68,7 @@ public class JDBCDefPane extends JPanel {
private UITextField urlTextField;
private UITextField userNameTextField;
private JPasswordField passwordTextField;
private ActionLabel odbcTipsLink;
// 请不要改动dbtype,只应该最后添加
private final String[] dbtype = {"Oracle", "DB2", "SQL Server", "MySQL", "Sybase", "Access", "Derby", "Postgre", "SQLite", "Inceptor", OTHER_DB};
@ -121,6 +125,28 @@ public class JDBCDefPane extends JPanel {
JPanel driverPane = FRGUIPaneFactory.createRightFlowInnerContainer_S_Pane();
driverPane.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Driver") + ":"));
// 选择ODBC数据源的时候的提示链接
JPanel odbcTipsPane = FRGUIPaneFactory.createRightFlowInnerContainer_S_Pane();
odbcTipsLink = new ActionLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Odbc_Tips")) {
@Override
public void paintComponent(Graphics _gfx) {
super.paintComponent(_gfx);
_gfx.setColor(Color.blue);
_gfx.drawLine(0, this.getHeight() - 1, GraphHelper.getWidth(this.getText()), this.getHeight() - 1);
}
};
odbcTipsPane.add(odbcTipsLink);
odbcTipsLink.setPreferredSize(new Dimension(GraphHelper.getWidth(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Odbc_Tips")), odbcTipsLink.getPreferredSize().height));
odbcTipsLink.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
String url = CloudCenter.getInstance().acquireUrlByKind("odbc.help");
BrowseUtils.browser(url);
}
});
JPanel driverComboBoxAndTips = new JPanel(new BorderLayout());
driverComboBoxAndTips.add(driverComboBox, BorderLayout.WEST);
driverComboBoxAndTips.add(odbcTipsPane, BorderLayout.CENTER);
JPanel urlPane = FRGUIPaneFactory.createRightFlowInnerContainer_S_Pane();
urlPane.add(new UILabel("URL:"));
@ -141,7 +167,7 @@ public class JDBCDefPane extends JPanel {
JPanel passwordPane = FRGUIPaneFactory.createRightFlowInnerContainer_S_Pane();
passwordPane.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Password") + ":"));
Component[][] components = {{dbtypePane, dbtypeComPane}, {driverPane, driverComboBox}, {urlPane, urlComPane}, {userPane, userComPane},};
Component[][] components = {{dbtypePane, dbtypeComPane}, {driverPane, driverComboBoxAndTips}, {urlPane, urlComPane}, {userPane, userComPane},};
double[] rowSize = {p, p, p, p};
double[] columnSize = {p, f, 22};
@ -267,6 +293,7 @@ public class JDBCDefPane extends JPanel {
if (driverComboBox.getSelectedItem() == null || ComparatorUtils.equals(driverComboBox.getSelectedItem(), StringUtils.EMPTY)) {
return;
}
odbcTipsLink.setVisible(ComparatorUtils.equals("sun.jdbc.odbc.JdbcOdbcDriver", driverComboBox.getSelectedItem())); // 选择的如果是ODBC就显示提示
Iterator<Entry<String, DriverURLName[]>> jdbc = jdbcMap.entrySet().iterator();
while (jdbc.hasNext()) {
Entry<String, DriverURLName[]> entry = jdbc.next();

6
designer-base/src/main/java/com/fr/design/dialog/FineJOptionPane.java

@ -1,6 +1,7 @@
package com.fr.design.dialog;
import com.fr.invoke.Reflect;
import com.fr.stable.StringUtils;
import javax.swing.Icon;
import javax.swing.JDialog;
@ -279,8 +280,11 @@ public class FineJOptionPane extends JOptionPane {
dialog.show();
dialog.dispose();
Object value = pane.getInputValue();
//点击取消按钮,返回null
if (StringUtils.equals((String) pane.getValue(), OPTION_OK_CANCEL[1]))
return null;
Object value = pane.getInputValue();
if (value == UNINITIALIZED_VALUE) {
return null;
}

20
designer-base/src/main/java/com/fr/design/extra/exe/GetPluginCategoriesExecutor.java

@ -1,10 +1,13 @@
package com.fr.design.extra.exe;
import com.fr.design.DesignerEnvManager;
import com.fr.design.extra.PluginConstants;
import com.fr.design.extra.Process;
import com.fr.general.CloudCenter;
import com.fr.general.http.HttpClient;
import com.fr.general.http.HttpToolbox;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils;
import java.util.Locale;
/**
* Created by vito on 16/5/16.
@ -28,14 +31,17 @@ public class GetPluginCategoriesExecutor implements Executor {
@Override
public void run(Process<String> process) {
String url = CloudCenter.getInstance().acquireUrlByKind("shop.plugin.category");
Locale locale = DesignerEnvManager.getEnvManager().getLanguage();
String url = CloudCenter.getInstance().acquireUrlByKind("shop.plugin.category") + "&locale=" + locale.toString();
if (StringUtils.isNotEmpty(url)) {
HttpClient httpClient = new HttpClient(url);
result = httpClient.getResponseText();
} else {
result = PluginConstants.CONNECTION_404;
try {
result = HttpToolbox.get(url);
return;
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
result = PluginConstants.CONNECTION_404;
}
}
};

45
designer-base/src/main/java/com/fr/design/formula/FormulaPane.java

@ -246,13 +246,45 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula {
}
public class DoubleClick extends MouseAdapter {
String singlePressContent;
String doublePressContent;
@Override
public void mousePressed(MouseEvent e) {
int index = tipsList.getSelectedIndex();
if (index != -1) {
if (e.getClickCount() == 1) {
singlePressContent = (String) listModel.getElementAt(index);
} else if (e.getClickCount() == 2) {
doublePressContent = (String) listModel.getElementAt(index);
}
}
}
@Override
public void mouseClicked(MouseEvent e) {
public void mouseReleased(MouseEvent e) {
int index = tipsList.getSelectedIndex();
if (index != -1) {
String currentLineContent = (String) listModel.getElementAt(index);
if (e.getClickCount() == 2) {
if (e.getClickCount() == 1) {
if (ComparatorUtils.equals((String) listModel.getElementAt(index), singlePressContent)) {
singleClickActuator(singlePressContent);
}
} else if (e.getClickCount() == 2) {
if (ComparatorUtils.equals((String) listModel.getElementAt(index), doublePressContent)) {
doubleClickActuator(doublePressContent);
}
}
}
}
private void singleClickActuator(String currentLineContent) {
refreshDescriptionTextArea(currentLineContent);
formulaTextArea.requestFocusInWindow();
fixFunctionNameList();
}
private void doubleClickActuator(String currentLineContent) {
if (ifHasBeenWriten == 0) {
formulaTextArea.setForeground(Color.black);
formulaTextArea.setText("");
@ -276,13 +308,6 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula {
insertPosition = position;
ifHasBeenWriten = 1;
listModel.removeAllElements();
} else if (e.getClickCount() == 1) {
refreshDescriptionTextArea(currentLineContent);
formulaTextArea.requestFocusInWindow();
fixFunctionNameList();
}
}
}
}

25
designer-base/src/main/java/com/fr/design/mainframe/chart/info/ChartInfo.java

@ -54,6 +54,8 @@ public class ChartInfo extends AbstractPointInfo {
private static final String ATTR_OVER_CHART_TYPE_COUNT = "overChartTypeCount";
private static final String ATTR_IS_NEW = "isNew";
private static final String ATTR_IS_REUSE = "isReuse";
private static final String ATTR_AUTO_CHART_CREATE_TIME = "autoChartCreateTime";
private static final String ATTR_AUTO_CHART_ENSURE_TIME = "autoChartEnsureTime";
private static final int COMPLETE_DAY_COUNT = 3; // 判断图表是否可以上传的天数
@ -122,10 +124,10 @@ public class ChartInfo extends AbstractPointInfo {
}
public static ChartInfo newInstance(ChartProvider chartProvider) {
return newInstance(chartProvider, null, false, false);
return newInstance(chartProvider, null, false, false, false);
}
public static ChartInfo newInstance(ChartProvider chartProvider, String createTime, boolean isNew, boolean isReuse) {
public static ChartInfo newInstance(ChartProvider chartProvider, String createTime, boolean isNew, boolean isReuse, boolean isAutoChart) {
HashMap<String, String> chartConsumingMap = new HashMap<>();
String username = MarketConfig.getInstance().getBbsUsername();
@ -163,6 +165,13 @@ public class ChartInfo extends AbstractPointInfo {
chartConsumingMap.put(ATTR_OVER_CHART_TYPE_COUNT, "0");
chartConsumingMap.put(ATTR_IS_NEW, String.valueOf(isNew));
chartConsumingMap.put(ATTR_IS_REUSE, String.valueOf(isReuse));
if (isAutoChart) {
chartConsumingMap.put(ATTR_AUTO_CHART_CREATE_TIME, createTime);
chartConsumingMap.put(ATTR_AUTO_CHART_ENSURE_TIME, typeTime);
} else {
chartConsumingMap.put(ATTR_AUTO_CHART_CREATE_TIME, StringUtils.EMPTY);
chartConsumingMap.put(ATTR_AUTO_CHART_ENSURE_TIME, StringUtils.EMPTY);
}
ChartInfo chartInfo = new ChartInfo(chartId, templateId, book);
chartInfo.chartConsumingMap = chartConsumingMap;
@ -202,6 +211,9 @@ public class ChartInfo extends AbstractPointInfo {
writer.attr(ATTR_OVER_CHART_TYPE_COUNT, chartConsumingMap.get(ATTR_OVER_CHART_TYPE_COUNT));
writer.attr(ATTR_IS_NEW, chartConsumingMap.get(ATTR_IS_NEW));
writer.attr(ATTR_IS_REUSE, chartConsumingMap.get(ATTR_IS_REUSE));
writer.attr(ATTR_AUTO_CHART_CREATE_TIME, chartConsumingMap.get(ATTR_AUTO_CHART_CREATE_TIME));
writer.attr(ATTR_AUTO_CHART_ENSURE_TIME, chartConsumingMap.get(ATTR_AUTO_CHART_ENSURE_TIME));
writer.end();
chartConfigInfo.writeXML(writer);
@ -238,6 +250,8 @@ public class ChartInfo extends AbstractPointInfo {
chartConsumingMap.put(ATTR_OVER_CHART_TYPE_COUNT, reader.getAttrAsString(ATTR_OVER_CHART_TYPE_COUNT, "0"));
chartConsumingMap.put(ATTR_IS_NEW, reader.getAttrAsString(ATTR_IS_NEW, StringUtils.EMPTY));
chartConsumingMap.put(ATTR_IS_REUSE, reader.getAttrAsString(ATTR_IS_REUSE, StringUtils.EMPTY));
chartConsumingMap.put(ATTR_AUTO_CHART_CREATE_TIME, reader.getAttrAsString(ATTR_AUTO_CHART_CREATE_TIME, StringUtils.EMPTY));
chartConsumingMap.put(ATTR_AUTO_CHART_ENSURE_TIME, reader.getAttrAsString(ATTR_AUTO_CHART_ENSURE_TIME, StringUtils.EMPTY));
}
if (ChartConfigInfo.XML_TAG.equals(name)) {
this.chartConfigInfo = (ChartConfigInfo) reader.readXMLObject(new ChartConfigInfo());
@ -276,6 +290,10 @@ public class ChartInfo extends AbstractPointInfo {
}
public void updateChartType(ChartProvider chartProvider) {
updateChartType(chartProvider, false);
}
public void updateChartType(ChartProvider chartProvider, boolean isAutoChart) {
String typeTime = DateTime.now().toString("yyyy-MM-dd HH:mm:ss");
chartConsumingMap.put(ATTR_CHART_TYPE_TIME, typeTime);
@ -285,6 +303,9 @@ public class ChartInfo extends AbstractPointInfo {
String count = chartConsumingMap.get(ATTR_OVER_CHART_TYPE_COUNT);
count = StringUtils.isEmpty(count) ? "1" : String.valueOf(Integer.parseInt(count) + 1);
chartConsumingMap.put(ATTR_OVER_CHART_TYPE_COUNT, count);
if (isAutoChart) {
chartConsumingMap.put(ATTR_AUTO_CHART_ENSURE_TIME, typeTime);
}
resetChartConfigInfo(chartProvider);
}

17
designer-base/src/main/java/com/fr/design/mainframe/chart/info/ChartInfoCollector.java

@ -12,6 +12,7 @@ import com.fr.stable.StringUtils;
import com.fr.stable.xml.XMLPrintWriter;
import com.fr.stable.xml.XMLableReader;
import com.fr.third.joda.time.DateTime;
import java.util.HashMap;
import java.util.Map;
@ -49,18 +50,22 @@ public class ChartInfoCollector extends AbstractPointCollector<ChartInfo> {
}
public void collection(ChartProvider chartProvider, String createTime) {
collection(chartProvider, createTime, false);
collection(chartProvider, createTime, false, false);
}
public void collection(ChartProvider chartProvider, String createTime, boolean isReuse) {
collection(chartProvider, createTime, isReuse, false);
}
/**
* 新建图表保存状态
*/
public void collection(ChartProvider chartProvider, String createTime, boolean isReuse) {
public void collection(ChartProvider chartProvider, String createTime, boolean isReuse, boolean isAutoChart) {
String chartId = chartProvider.getChartUuid();
if (!shouldCollectInfo() || StringUtils.isEmpty(chartId)) {
return;
}
ChartInfo chartInfo = ChartInfo.newInstance(chartProvider, createTime, true, isReuse);
ChartInfo chartInfo = ChartInfo.newInstance(chartProvider, createTime, true, isReuse, isAutoChart);
chartInfoCacheMap.put(chartId, chartInfo);
}
@ -116,6 +121,10 @@ public class ChartInfoCollector extends AbstractPointCollector<ChartInfo> {
* 图表类型变化更新类型和类型确认时间
*/
public void updateChartTypeTime(ChartProvider chartProvider, String oldType) {
updateChartTypeTime(chartProvider, oldType, false);
}
public void updateChartTypeTime(ChartProvider chartProvider, String oldType, boolean isAutoChart) {
if (!shouldCollectInfo() || StringUtils.isEmpty(chartProvider.getChartUuid())) {
return;
}
@ -123,7 +132,7 @@ public class ChartInfoCollector extends AbstractPointCollector<ChartInfo> {
ChartInfo chartInfo = getOrCreateChartInfo(chartProvider, oldType);
//更新类型确认时间和类型
chartInfo.updateChartType(chartProvider);
chartInfo.updateChartType(chartProvider, isAutoChart);
//重置计数
chartInfo.resetIdleDayCount();

1
designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogHandlerBar.java

@ -93,6 +93,7 @@ public class LogHandlerBar extends JPanel implements ItemSelectable {
public void clearMessage() {
INFONUM = ERRORNUM = SERVERNUM = 0;
LogMessageBar.getInstance().clear();
changeLabel();
}

6
designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogMessageBar.java

@ -2,6 +2,7 @@ package com.fr.design.mainframe.loghandler;
import com.fr.design.constants.UIConstants;
import com.fr.design.gui.ilable.UILabel;
import com.fr.stable.StringUtils;
import javax.swing.JFrame;
@ -63,6 +64,11 @@ public class LogMessageBar extends JPanel {
repaint();
}
public void clear() {
messageLabel.setText(StringUtils.EMPTY);
repaint();
}
public void setLoggerBarWidth(int width) {
this.width = width;
}

6
designer-base/src/main/java/com/fr/design/utils/gui/GUICoreUtils.java

@ -398,9 +398,11 @@ public final class GUICoreUtils {
Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
screen.setSize(screen.getSize().width, screen.height - HEIGHT_GAP);
int showOnScreenX = Math.min(screen.width, parentComponent.getLocationOnScreen().x + parentComponent.getWidth());
// peter:调整X的高度.
if (point.x + size.width > screen.width && size.width < screen.width) {
x += (screen.width - point.x - size.width);
if (point.x + size.width > showOnScreenX && size.width < showOnScreenX) {
x += (showOnScreenX - point.x - size.width);
}
// peter:调整y高度.

1
designer-base/src/main/java/com/fr/start/server/FineEmbedServerActivator.java

@ -73,6 +73,7 @@ public class FineEmbedServerActivator extends Activator {
//覆盖tomcat的WebAppClassLoader
context.setLoader(new FRTomcatLoader());
//直接指定initializer,tomcat就不用再扫描一遍了
SpringServletContainerInitializer initializer = new SpringServletContainerInitializer();
Set<Class<?>> classes = new HashSet<Class<?>>();

15
designer-chart/src/main/java/com/fr/design/chart/AutoChartDialog.java

@ -7,6 +7,9 @@ import com.fr.chartx.TwoTuple;
import com.fr.design.i18n.Toolkit;
import com.fr.plugin.chart.vanchart.VanChart;
import javax.swing.JList;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import java.awt.Component;
import java.awt.Dialog;
import java.awt.Frame;
@ -33,14 +36,22 @@ public class AutoChartDialog extends ChartDialog {
protected Component initCenterPane() {
autoChartTypePane = new AutoChartTypePane();
getOk().setEnabled(false);
autoChartTypePane.registsListAction(new ListSelectionListener() {
@Override
public void valueChanged(ListSelectionEvent e) {
getOk().setEnabled(((JList) e.getSource()).getSelectedIndex() >= 0);
}
});
return autoChartTypePane;
}
protected ActionListener getActionListener() {
protected ActionListener getActionListener(final String createTime) {
return new ActionListener() {
public void actionPerformed(ActionEvent e) {
ChartCollection chartCollection = (ChartCollection) getChartCollection();
autoChartTypePane.update(chartCollection);
autoChartTypePane.update(chartCollection, createTime);
if (chartCollection.getChartCount() > 0) {
doOK();
} else {

2
designer-chart/src/main/java/com/fr/design/chart/AutoChartIcon.java

@ -66,7 +66,7 @@ public class AutoChartIcon implements Icon {
public void paintIcon(Component c, Graphics g, int x, int y) {
BaseChartPainter painter = chartCollection.createResultChartPainterWithOutDealFormula(Calculator.createCalculator(),
WebChartIDInfo.createEmptyDesignerInfo(), getIconWidth(), getIconHeight());
WebChartIDInfo.createAutoTypeInfo(), getIconWidth(), getIconHeight());
int resolution = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().getJTemplateResolution();

120
designer-chart/src/main/java/com/fr/design/chart/AutoChartTypePane.java

@ -2,28 +2,42 @@ package com.fr.design.chart;
import com.fr.base.chart.chartdata.CallbackEvent;
import com.fr.chart.chartattr.ChartCollection;
import com.fr.chartx.attr.ChartProvider;
import com.fr.design.chart.auto.AutoTypeCalculate;
import com.fr.design.data.DesignTableDataManager;
import com.fr.design.data.datapane.TableDataComboBox;
import com.fr.design.data.tabledata.wrapper.TableDataWrapper;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.icombocheckbox.UIComboCheckBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.iprogressbar.AutoProgressBar;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.chart.info.ChartInfoCollector;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.GeneralUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.chart.vanchart.VanChart;
import javax.swing.BorderFactory;
import javax.swing.DefaultListCellRenderer;
import javax.swing.DefaultListModel;
import javax.swing.JList;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JSplitPane;
import javax.swing.ListCellRenderer;
import javax.swing.SwingWorker;
import javax.swing.UIManager;
import javax.swing.event.ListSelectionListener;
import javax.swing.plaf.SplitPaneUI;
import javax.swing.plaf.basic.BasicSplitPaneUI;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CancellationException;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
@ -46,6 +60,9 @@ public class AutoChartTypePane extends ChartWizardPane implements CallbackEvent
private TableDataComboBox tableNameComboBox;
private UIComboCheckBox dataFieldBox;
private AutoProgressBar connectionBar;
private SwingWorker worker;
public AutoChartTypePane() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
initButtonGroup();
@ -62,10 +79,15 @@ public class AutoChartTypePane extends ChartWizardPane implements CallbackEvent
chartViewList.setCellRenderer(iconCellRenderer);
JScrollPane subListPane = new JScrollPane(chartViewList);
subListPane.setBorder(BorderFactory.createTitledBorder(Toolkit.i18nText("Fine-Design_Chart_Recommended_Chart")));
JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, false, contentPane, subListPane);
JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, true, contentPane, subListPane);
SplitPaneUI ui = splitPane.getUI();
if (ui instanceof BasicSplitPaneUI) {
((BasicSplitPaneUI) ui).getDivider().setBorder(null);
}
splitPane.setDividerLocation(60);
splitPane.setBorder(BorderFactory.createTitledBorder(Toolkit.i18nText("Fine-Design_Chart_M_Popup_Auto_Chart_Type")));
this.add(splitPane);
}
@ -94,7 +116,7 @@ public class AutoChartTypePane extends ChartWizardPane implements CallbackEvent
JPanel tableDataPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
panel.add(tableDataPane);
tableDataPane.add(new UILabel(Toolkit.i18nText("Fine-Design_Chart_Table_Data") + ":"));
tableNameComboBox.setPreferredSize(new Dimension(96, 20));
tableNameComboBox.setPreferredSize(new Dimension(126, 20));
tableDataPane.add(tableNameComboBox);
JPanel areaNamePane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
@ -102,6 +124,7 @@ public class AutoChartTypePane extends ChartWizardPane implements CallbackEvent
areaNamePane.add(new UILabel(Toolkit.i18nText("Fine-Design_Chart_Data_Field") + ":"));
areaNamePane.add(dataFieldBox);
panel.add(refreshButton);
panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
return panel;
}
@ -136,6 +159,10 @@ public class AutoChartTypePane extends ChartWizardPane implements CallbackEvent
}
}
public void registsListAction(ListSelectionListener listSelectionListener) {
chartViewList.addListSelectionListener(listSelectionListener);
}
private void refreshBox() {
TableDataWrapper dataWrap = tableNameComboBox.getSelectedItem();
@ -154,6 +181,7 @@ public class AutoChartTypePane extends ChartWizardPane implements CallbackEvent
refreshButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
refreshButton.setEnabled(false);
calculateAutoChart();
}
});
@ -161,7 +189,56 @@ public class AutoChartTypePane extends ChartWizardPane implements CallbackEvent
}
private void calculateAutoChart() {
connectionBar = new AutoProgressBar(this, Toolkit.i18nText("Fine-Design_Chart_Generate_Recommended_Chart"), "", 0, 100) {
public void doMonitorCanceled() {
refreshButton.setEnabled(true);
worker.cancel(true);
}
};
setWorker();
worker.execute();
}
private void setWorker() {
worker = new SwingWorker<List<VanChart>, Void>() {
protected List<VanChart> doInBackground() {
connectionBar.start();
chartResultModel.clear();
List<String> columnList = new ArrayList<>();
Object[] selectedValues = dataFieldBox.getSelectedValues();
for (Object value : selectedValues) {
columnList.add(GeneralUtils.objectToString(value));
}
List<VanChart> vanChartList = AutoTypeCalculate.calculateType(tableNameComboBox.getSelectedItem().getTableDataName(), columnList);
connectionBar.close();
return vanChartList;
}
public void done() {
try {
List<VanChart> vanChartList = get();
if (vanChartList != null && !vanChartList.isEmpty()) {
for (VanChart vanChart : vanChartList) {
ChartCollection chartCollection = new ChartCollection(vanChart);
AutoChartIcon autoChartIcon = new AutoChartIcon(chartCollection);
autoChartIcon.registerCallBackEvent(AutoChartTypePane.this);
chartResultModel.addElement(autoChartIcon);
}
chartViewList.setSelectedIndex(0);
}
} catch (Exception e) {
if (!(e instanceof CancellationException)) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
FineJOptionPane.showMessageDialog(AutoChartTypePane.this, e.getMessage(),
Toolkit.i18nText("Fine-Design_Basic_Error"), JOptionPane.ERROR_MESSAGE, UIManager.getIcon("OptionPane.errorIcon"));
}
} finally {
connectionBar.close();
refreshButton.setEnabled(true);
}
}
};
}
@Override
@ -171,16 +248,7 @@ public class AutoChartTypePane extends ChartWizardPane implements CallbackEvent
@Override
public void update(ChartCollection cc) {
if (chartViewList.getSelectedIndex() < 0) {
return;
}
AutoChartIcon chartIcon = (AutoChartIcon) chartViewList.getSelectedValue();
ChartProvider chartProvider = chartIcon.getChartCollection().getSelectedChartProvider(ChartProvider.class);
if (cc.getChartCount() > 0) {
cc.setSelectChart(chartProvider);
} else {
cc.addChart(chartProvider);
}
update(cc, null);
}
public void populate(String tableName, String[] dataFields) {
@ -190,6 +258,30 @@ public class AutoChartTypePane extends ChartWizardPane implements CallbackEvent
map.put(dataField, true);
}
dataFieldBox.setSelectedValues(map);
if (refreshButton.isEnabled()) {
refreshButton.setEnabled(false);
calculateAutoChart();
}
}
public void update(ChartCollection cc, String createTime) {
if (chartViewList.getSelectedIndex() < 0) {
return;
}
AutoChartIcon chartIcon = (AutoChartIcon) chartViewList.getSelectedValue();
VanChart vanChart = chartIcon.getChartCollection().getSelectedChartProvider(VanChart.class);
if (cc.getChartCount() > 0) {
VanChart selectedChartProvider = cc.getSelectedChartProvider(VanChart.class);
if (selectedChartProvider.getChartUuid() != null) {
vanChart.setUuid(selectedChartProvider.getChartUuid());
}
cc.setSelectChart(vanChart);
ChartInfoCollector.getInstance().updateChartTypeTime(vanChart, null, true);
} else {
cc.addChart(vanChart);
//记录埋点
ChartInfoCollector.getInstance().collection(vanChart, createTime, false, true);
}
}
@Override

18
designer-chart/src/main/java/com/fr/design/chart/ChartDialog.java

@ -31,7 +31,6 @@ public class ChartDialog extends MiddleChartDialog {
private UIButton ok;
private UIButton cancel;
private ChartTypePane chartTypePane;
private String createTime;
public ChartDialog(Frame owner) {
super(owner);
@ -44,11 +43,14 @@ public class ChartDialog extends MiddleChartDialog {
}
private void initComponent() {
createTime = DateTime.now().toString("yyyy-MM-dd HH:mm:ss");
String createTime = DateTime.now().toString("yyyy-MM-dd HH:mm:ss");
this.setModal(true);
this.setLayout(new BorderLayout());
setTitle(getDialogTitle());
ok = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_OK"));
cancel = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Cancel"));
this.applyClosingAction();
this.applyEscapeAction();
this.setBasicDialogSize(BasicDialog.DEFAULT);
@ -58,10 +60,7 @@ public class ChartDialog extends MiddleChartDialog {
buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
this.add(buttonPane, BorderLayout.SOUTH);
ok = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_OK"));
cancel = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Cancel"));
ok.addActionListener(getActionListener());
ok.addActionListener(getActionListener(createTime));
cancel.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
doCancel();
@ -83,7 +82,7 @@ public class ChartDialog extends MiddleChartDialog {
return chartTypePane;
}
protected ActionListener getActionListener() {
protected ActionListener getActionListener(final String createTime) {
return new ActionListener() {
public void actionPerformed(ActionEvent e) {
chartTypePane.update((ChartCollection) cc, createTime);
@ -92,6 +91,11 @@ public class ChartDialog extends MiddleChartDialog {
};
}
public UIButton getOk() {
return ok;
}
/**
* 不处理
*/

143
designer-chart/src/main/java/com/fr/design/chart/auto/AutoTypeCalculate.java

@ -0,0 +1,143 @@
package com.fr.design.chart.auto;
import com.fr.chart.auto.ColumnInfo;
import com.fr.chart.auto.strategy.AutoTypeStrategy;
import com.fr.chart.auto.strategy.imp.AvaStrategy;
import com.fr.chart.auto.strategy.imp.BubbleChartStrategy;
import com.fr.chart.auto.strategy.imp.SingleDimensionStrategy;
import com.fr.chart.auto.strategy.imp.SingleTargetStrategy;
import com.fr.data.TableDataSource;
import com.fr.data.TableDataSourceTailor;
import com.fr.data.impl.EmbeddedTableData;
import com.fr.data.impl.NameTableData;
import com.fr.design.data.DesignTableDataManager;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.general.ComparatorUtils;
import com.fr.general.GeneralUtils;
import com.fr.general.data.DataModel;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.chart.vanchart.VanChart;
import com.fr.script.Calculator;
import com.fr.stable.StringUtils;
import java.util.ArrayList;
import java.util.List;
/**
* @author Bjorn
* @version 10.0
* Created by Bjorn on 2020-05-08
*/
public class AutoTypeCalculate {
public static List<VanChart> calculateType(String tableName, List<String> columns) {
List<ColumnInfo> columnValue = calculateField(tableName, columns);
if (columnValue.isEmpty()) {
return new ArrayList<>();
}
List<ColumnInfo> dimensions = new ArrayList<>();
List<ColumnInfo> targets = new ArrayList<>();
for (ColumnInfo field : columnValue) {
if (isTarget(field.getValues())) {
targets.add(field);
} else {
dimensions.add(field);
}
}
AutoTypeStrategy autoTypeStrategy = chooseStrategy(dimensions.size(), targets.size());
return autoTypeStrategy.rankChart(tableName, dimensions, targets);
}
private static AutoTypeStrategy chooseStrategy(int dimensionSize, int targetSize) {
if (dimensionSize == 0) {
//没有维度,并且只有一个指标,使用单指标匹配逻辑,大于1个指标,使用气泡图(散点图)匹配逻辑
if (targetSize == 1) {
return new SingleTargetStrategy();
} else {
return new BubbleChartStrategy();
}
} else if (dimensionSize == 1) {
//1个维度,并且没有指标,使用单维度匹配,2~3个指标,使用气泡图(散点图)匹配逻辑,其余使用ava匹配
if (targetSize == 0) {
return new SingleDimensionStrategy();
} else if (targetSize == 2 || targetSize == 3) {
return new BubbleChartStrategy();
} else {
return new AvaStrategy();
}
} else {
//大与1个维度,并且没有指标,使用单维度匹配(循环),否则使用ava匹配
if (targetSize == 0) {
return new SingleDimensionStrategy();
} else {
return new AvaStrategy();
}
}
}
private static boolean isTarget(List<String> values) {
for (String value : values) {
if (StringUtils.isEmpty(value)) {
continue;
}
Number number = GeneralUtils.string2Number(value);
if (number == null) {
return false;
}
}
return true;
}
private static List<ColumnInfo> calculateField(String tableName, List<String> columns) {
NameTableData nameTableData = new NameTableData(tableName);
TableDataSource dataSource = TableDataSourceTailor.extractTableData(HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().getTarget());
Calculator calculator = Calculator.createCalculator();
calculator.setAttribute(TableDataSource.KEY, dataSource);
nameTableData.createTableData(calculator);
EmbeddedTableData tableData;
try {
tableData = DesignTableDataManager.previewTableDataNeedInputParameters(dataSource, nameTableData, Integer.MAX_VALUE, false);
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
return new ArrayList<>();
}
List<ColumnInfo> originalData = new ArrayList<>();
for (String column : columns) {
List<String> columnData = getColumnData(tableData, column);
if (columnData != null && !columnData.isEmpty()) {
originalData.add(new ColumnInfo(column, columnData));
}
}
return originalData;
}
private static List<String> getColumnData(EmbeddedTableData tableData, String columnName) {
List<String> columnData = new ArrayList<>();
int colIndex = getColIndex(tableData, columnName);
if (colIndex == DataModel.COLUMN_NAME_NOT_FOUND) {
return columnData;
}
int size = tableData.getRowCount();
for (int i = 0; i < size; i++) {
Object valueAt = tableData.getValueAt(i, colIndex);
columnData.add(GeneralUtils.objectToString(valueAt));
}
return columnData;
}
private static int getColIndex(EmbeddedTableData tableData, String columnName) {
int colIndex = 0;
for (int count = tableData.getColumnCount(); colIndex < count; ++colIndex) {
if (ComparatorUtils.tableDataColumnNameEquals(tableData.getColumnName(colIndex), columnName)) {
return colIndex;
}
}
return DataModel.COLUMN_NAME_NOT_FOUND;
}
}

26
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypePane.java

@ -111,12 +111,15 @@ public class ChartTypePane extends AbstractChartAttrPane {
autoButtonListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
final String lastId = editingCollection.getSelectedChartProvider(ChartProvider.class).getID();
final MiddleChartDialog autoChartDialog = DesignModuleFactory.getAutoChartDialog(DesignerContext.getDesignerFrame());
autoChartDialog.populate(editingCollection);
autoChartDialog.addDialogActionListener(new DialogActionAdapter() {
@Override
public void doOk() {
populate(editingCollection);
ChartProvider chart = editingCollection.getSelectedChartProvider(ChartProvider.class);
reLayoutEditPane(chart, lastId);
}
});
autoChartDialog.setVisible(true);
@ -124,6 +127,17 @@ public class ChartTypePane extends AbstractChartAttrPane {
};
}
private void reLayoutEditPane(ChartProvider chart, String lastChartId) {
String chartId = chart.getID();
//chartID改变的话图表类型就算改变了
if (StringUtils.isNotEmpty(chartId)) {
boolean isUseDefault = ChartTypeInterfaceManager.getInstance().isUseDefaultPane(chartId);
if (editPane.isDefaultPane() != isUseDefault || (!isUseDefault && !ComparatorUtils.equals(lastChartId, chartId))) {
editPane.reLayout(chart);
}
}
}
class ComboBoxPane extends UIComboBoxPane<ChartProvider> {
private Map<String, Map<String, FurtherBasicBeanPane<? extends ChartProvider>>> allChartTypePane;
@ -167,17 +181,7 @@ public class ChartTypePane extends AbstractChartAttrPane {
//这一步会替换plot
((AbstractChartTypePane) getSelectedPane()).updateBean(chart);
String chartID = chart.getID();
//chartID改变的话图表类型就算改变了
if (StringUtils.isNotEmpty(chartID)) {
boolean isUseDefault = ChartTypeInterfaceManager.getInstance().isUseDefaultPane(chartID);
if (editPane.isDefaultPane() != isUseDefault || (!isUseDefault && !ComparatorUtils.equals(lastPlotID, chartID))) {
editPane.reLayout(chart);
}
}
reLayoutEditPane(chart,lastPlotID);
}
protected UIComboBox createComboBox() {

1
designer-chart/src/main/java/com/fr/van/chart/custom/VanChartCustomDataPane.java

@ -27,6 +27,7 @@ public class VanChartCustomDataPane extends ChartDataPane {
}
contentsTabPane = new VanChartCustomPlotDataContentsTabPane((VanChartCustomPlot)chart.getPlot(), VanChartCustomDataPane.this, listener);
contentsTabPane.setSupportCellData(isSupportCellData());
content.add(contentsTabPane, BorderLayout.CENTER);
return content;

19
designer-chart/src/main/java/com/fr/van/chart/custom/VanChartCustomPlotDataContentsTabPane.java

@ -22,10 +22,21 @@ import java.util.Map;
* Created by Fangjie on 2016/4/29.
*/
public class VanChartCustomPlotDataContentsTabPane extends VanChartCustomPlotTabPane<VanChartCustomPlot, ChartCollection> {
private boolean supportCellData;
public VanChartCustomPlotDataContentsTabPane(VanChartCustomPlot plot, VanChartCustomDataPane parent, AttributeChangeListener listener) {
super(plot, parent, listener);
}
public boolean isSupportCellData() {
return supportCellData;
}
public void setSupportCellData(boolean supportCellData) {
this.supportCellData = supportCellData;
}
@Override
protected void initTabTitle() {
@ -60,6 +71,7 @@ public class VanChartCustomPlotDataContentsTabPane extends VanChartCustomPlotTab
for (int i = 0; i < customPlotList.size(); i++) {
//根据不同的plot创建不同的数据配置界面
ChartDataPane contentPane = new VanChartDataPane(listener);
contentPane.setSupportCellData(supportCellData);
paneList.add(contentPane);
}
@ -71,12 +83,9 @@ public class VanChartCustomPlotDataContentsTabPane extends VanChartCustomPlotTab
plot = (VanChartCustomPlot) chartCollection.getSelectedChart().getPlot();
if (paneList == null){
paneList = initPaneList();
}
if (paneList != null){
relayoutWhenListChange();
try {
List<VanChartPlot> customPlotList = plot.getCustomPlotList();
@ -104,7 +113,6 @@ public class VanChartCustomPlotDataContentsTabPane extends VanChartCustomPlotTab
return;
}
}
}
@Override
public ChartCollection updateBean() {
@ -168,6 +176,7 @@ public class VanChartCustomPlotDataContentsTabPane extends VanChartCustomPlotTab
/**
* 返回绑定的属性事件.
*
* @param listener 增加监听
*/
public void addAttributeChangeListener(AttributeChangeListener listener) {

44
designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartBaseAxisPane.java

@ -54,11 +54,13 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane<VanChartAxis> {
private static final long serialVersionUID = -5717246802333308973L;
private static final double ROTATION_MAX = 90.0;
protected UIButtonGroup showTitle;
protected TinyFormulaPane titleContent;
protected UIButtonGroup<Integer> titleAlignPane;
protected UIToggleButton titleUseHtml;
protected ChartTextAttrPane titleTextAttrPane;
protected UINumberDragPane titleTextRotation;
protected JPanel titlePane;
protected UIButtonGroup showLabel;
protected ChartTextAttrPane labelTextAttrPane;
@ -108,6 +110,7 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane<VanChartAxis> {
public void setParentPane(VanChartStylePane parent) {
htmlLabelPane.setParent(parent);
}
protected void reLayoutPane(boolean isXAxis) {
this.removeAll();
this.add(createContentPane(isXAxis), BorderLayout.CENTER);
@ -123,7 +126,7 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane<VanChartAxis> {
double[] column = {f, s};
double[] rowSize = {p, p, p, p, p, p, p, p};
Component[][] components = new Component[][]{
new Component[]{createTitlePane(new double[]{p, p, p, p, p, p}, columnSize, isXAxis), null},
new Component[]{createTitlePane(new double[]{p, p, p, p, p, p}, column, isXAxis), null},
new Component[]{createLabelPane(new double[]{p, p}, column), null},
new Component[]{createLineStylePane(new double[]{p, p, p, p, p}, columnSize), null},
new Component[]{createAxisPositionPane(new double[]{p, p, p}, columnSize, isXAxis), null},
@ -135,12 +138,13 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane<VanChartAxis> {
}
protected JPanel createTitlePane(double[] row, double[] col, boolean isXAxis) {
showTitle = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Use_Show"), Toolkit.i18nText("Fine-Design_Chart_Hidden")});
titleAlignPane = isXAxis ? getXAxisTitleAlignPane() : getYAxisTitleAlignPane();
titleAlignPane.setSelectedItem(Constants.CENTER);
titleContent = new TinyFormulaPane();
titleUseHtml = new UIToggleButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Html"));
UIComponentUtils.setLineWrap(titleUseHtml);
titleTextAttrPane = new ChartTextAttrPane();
titleTextAttrPane = getChartTextAttrPane();
titleTextRotation = new UINumberDragPane(-ROTATION_MAX, ROTATION_MAX);
if (isXAxis) {
titleTextRotation.populateBean(0.0);
@ -158,9 +162,22 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane<VanChartAxis> {
UIComponentUtils.wrapWithBorderLayoutPane(titleTextRotation)
},
};
titlePane = TableLayout4VanChartHelper.createGapTableLayoutPane(components, row, col);
titlePane.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 0));
JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components, row, col);
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(PaneTitleConstants.CHART_STYLE_TITLE_TITLE, panel);
JPanel showTitlePane = TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Axis_Title"), showTitle);
showTitle.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
checkTitlePane();
}
});
JPanel jPanel = new JPanel(new BorderLayout());
jPanel.add(showTitlePane, BorderLayout.NORTH);
jPanel.add(titlePane, BorderLayout.CENTER);
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(PaneTitleConstants.CHART_STYLE_TITLE_TITLE, jPanel);
}
private UIButtonGroup<Integer> getXAxisTitleAlignPane() {
@ -171,6 +188,7 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane<VanChartAxis> {
return new UIButtonGroup<Integer>(alignmentIconArray, alignment);
}
private UIButtonGroup<Integer> getYAxisTitleAlignPane() {
Icon[] alignmentIconArray = {BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/v_top_normal.png"),
BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/v_center_normal.png"),
@ -462,6 +480,7 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane<VanChartAxis> {
protected void checkAllUse() {
checkCardPane();
checkLabelPane();
checkTitlePane();
//区域显示策略 恢复用注释。删除下面一行。
checkMaxProPortionUse();
@ -505,6 +524,12 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane<VanChartAxis> {
}
}
protected void checkTitlePane() {
if (showTitle != null && titlePane != null) {
titlePane.setVisible(showTitle.getSelectedIndex() == 0);
}
}
private void checkLabelGapAndStylePane() {
if (overlapHandleTypeGroup != null && labelGapStylePane != null) {
boolean visible = overlapHandleTypeGroup.getSelectedItem() == OverlapHandleType.INTERVAL;
@ -528,6 +553,7 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane<VanChartAxis> {
/**
* 是否是指定类型
*
* @param ob 对象
* @return 是否是指定类型
*/
@ -537,6 +563,7 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane<VanChartAxis> {
/**
* title应该是一个属性不只是对话框的标题时用到与其他组件结合时也会用得到
*
* @return 绥化狂标题
*/
@Override
@ -550,6 +577,7 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane<VanChartAxis> {
public void reset() {
}
@Override
public void populateBean(VanChartAxis axis) {
populateTitle(axis);
@ -569,6 +597,9 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane<VanChartAxis> {
//标题
private void populateTitle(VanChartAxis axis) {
if (showTitle != null) {
showTitle.setSelectedIndex(axis.isShowAxisTitle() ? 0 : 1);
}
Title axisTitle = axis.getTitle();
if (axisTitle != null) {
if (axisTitle.getTextObject() instanceof BaseFormula && titleContent != null) {
@ -690,8 +721,12 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane<VanChartAxis> {
updateFormat(axis);
}
//标题
private void updateTitle(VanChartAxis axis) {
if (showTitle != null) {
axis.setShowAxisTitle(showTitle.getSelectedIndex() == 0);
}
Title axisTitle = axis.getTitle();
if (axisTitle == null) {
axisTitle = new Title();
@ -810,6 +845,7 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane<VanChartAxis> {
/**
* X坐标轴不同类型切换,new一个新的
*
* @param axisName 坐标轴名称
* @return 新的axis
*/

8
designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartTimeAxisPane.java

@ -27,15 +27,15 @@ import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import java.text.ParseException;
import java.util.Date;
import java.util.regex.Pattern;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.text.ParseException;
import java.util.Date;
import java.util.regex.Pattern;
/**
* 时间坐标轴
@ -68,7 +68,7 @@ public class VanChartTimeAxisPane extends VanChartBaseAxisPane {
double[] column = {f, s};
double[] rowSize = {p,p,p,p,p,p,p,p,p,p,p,p,p,p};
Component[][] components = new Component[][]{
new Component[]{createTitlePane(new double[]{p, p, p, p, p,p}, columnSize, isXAxis),null},
new Component[]{createTitlePane(new double[]{p, p, p, p, p,p}, column, isXAxis),null},
new Component[]{createLabelPane(new double[]{p, p}, column),null},
new Component[]{createValueDefinition(),null},
new Component[]{createLineStylePane(new double[]{p, p,p,p,p}, columnSize),null},

2
designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartValueAxisPane.java

@ -49,7 +49,7 @@ public class VanChartValueAxisPane extends VanChartBaseAxisPane {
double[] column = {f, s};
double[] rowSize = {p,p,p,p,p,p,p,p,p,p,p,p,p,p};
Component[][] components = new Component[][]{
new Component[]{createTitlePane(new double[]{p, p, p, p, p, p}, columnSize, isXAxis), null},
new Component[]{createTitlePane(new double[]{p, p, p, p, p, p}, column, isXAxis), null},
new Component[]{createLabelPane(new double[]{p, p}, column), null},
new Component[]{createMinMaxValuePane(new double[]{p, p}, columnSize), null},
new Component[]{createLineStylePane(new double[]{p, p, p, p, p}, columnSize), null},

10
designer-chart/src/main/java/com/fr/van/chart/map/designer/data/contentpane/table/VanPointMapPlotTableDataContentPane.java

@ -4,9 +4,11 @@ import com.fr.design.beans.BasicBeanPane;
import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.ilable.BoldFontTextLabel;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.chart.gui.ChartDataPane;
import com.fr.design.widget.FRWidgetFactory;
import com.fr.plugin.chart.map.data.VanMapTableDefinitionProvider;
import com.fr.van.chart.map.designer.data.component.table.AbstractLongLatAreaPane;
import com.fr.van.chart.map.designer.data.component.table.AreaPane;
@ -91,6 +93,7 @@ public class VanPointMapPlotTableDataContentPane extends VanAreaMapPlotTableData
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double labelWidth = 65;
this.setLayout(new BorderLayout(0, 5));
centerPane = new JPanel(new CardLayout()) {
@ -122,13 +125,14 @@ public class VanPointMapPlotTableDataContentPane extends VanAreaMapPlotTableData
locationType.setSelectedIndex(0);
double[] columnSize = {p, f};
double[] columnSize = {labelWidth, f};
double[] rowSize = {p};
UILabel label = FRWidgetFactory.createLineWrapLabel(Toolkit.i18nText("Fine-Design_Chart_Geographic"));
Component[][] components = new Component[][]{
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Geographic")), locationType},
new Component[]{label, locationType},
};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 30, 6);
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 5, 6);
this.add(panel, BorderLayout.NORTH);
this.add(centerPane, BorderLayout.CENTER);

2
designer-form/src/main/java/com/fr/design/designer/beans/models/SelectionModel.java

@ -262,7 +262,7 @@ public class SelectionModel {
Rectangle rec = selection.getSelctionBounds();
FormSelectionUtils.paste2Container(designer, container, clipboard, rec.x + DELTA_X_Y, rec.y + DELTA_X_Y);
} else if (isExtraContainer(container)) {
provider.paste2Container(selection);
provider.paste2Container(clipboard);
}
}

53
designer-form/src/main/java/com/fr/design/mainframe/ShareWidgetButton.java

@ -14,6 +14,7 @@ import com.fr.general.ComparatorUtils;
import com.fr.general.IOUtils;
import com.fr.share.ShareConstants;
import com.fr.stable.StringUtils;
import org.jetbrains.annotations.NotNull;
import javax.swing.Icon;
import javax.swing.ImageIcon;
@ -52,12 +53,12 @@ import java.io.Serializable;
*/
public class ShareWidgetButton extends JPanel implements MouseListener, MouseMotionListener, Serializable {
private static final Dimension TAB_DEFAULT_SIZE = new Dimension(500, 300);
private SharableWidgetProvider bindInfo;
private MouseEvent lastPressEvent;
private JPanel reportPane;
private boolean isEdit;
private boolean isMarked;
protected SharableWidgetProvider bindInfo;
protected MouseEvent lastPressEvent;
protected JPanel reportPane;
protected boolean isEdit;
protected boolean isMarked;
private ShareWidgetUI ui;
private Icon markedMode = IOUtils.readIcon("/com/fr/design/form/images/marked.png");
private Icon unMarkedMode = IOUtils.readIcon("/com/fr/design/form/images/unmarked.png");
private AlphaComposite composite = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 60 / 100.0F);
@ -72,8 +73,10 @@ public class ShareWidgetButton extends JPanel implements MouseListener, MouseMot
}
};
public ShareWidgetButton(SharableWidgetProvider bindInfo) {
public ShareWidgetButton(SharableWidgetProvider bindInfo, ShareWidgetUI ui) {
this.bindInfo = bindInfo;
this.ui = ui;
this.setPreferredSize(new Dimension(108, 68));
initUI();
this.setLayout(getCoverLayout());
@ -82,6 +85,11 @@ public class ShareWidgetButton extends JPanel implements MouseListener, MouseMot
new DragAndDropDragGestureListener(this, DnDConstants.ACTION_COPY_OR_MOVE);
}
public ShareWidgetButton(SharableWidgetProvider bindInfo) {
this(bindInfo, new ShareWidgetUI());
}
public void paint(Graphics g) {
Graphics2D g2d = (Graphics2D) g;
Composite oldComposite = g2d.getComposite();
@ -219,14 +227,7 @@ public class ShareWidgetButton extends JPanel implements MouseListener, MouseMot
if (creatorSource != null) {
((AbstractBorderStyleWidget)creatorSource).addWidgetAttrMark(new SharableAttrMark(true));
//tab布局WCardMainBorderLayout通过反射出来的大小是960*480
XCreator xCreator = null;
if (creatorSource instanceof WCardMainBorderLayout) {
xCreator = XCreatorUtils.createXCreator(creatorSource, TAB_DEFAULT_SIZE);
} else {
xCreator = XCreatorUtils.createXCreator(creatorSource);
}
xCreator.setBackupBound(new Rectangle(no.getBindInfo().getWidth(), no.getBindInfo().getHeight()));
xCreator.setShareId(shareId);
XCreator xCreator = ui.createXCreator(creatorSource, shareId, no.getBindInfo());
WidgetToolBarPane.getTarget().startDraggingBean(xCreator);
lastPressEvent = null;
this.setBorder(null);
@ -288,4 +289,26 @@ public class ShareWidgetButton extends JPanel implements MouseListener, MouseMot
return widget;
}
}
/**
* 抽出来专门为了创建 ui 来搞
*/
public static class ShareWidgetUI {
private static final Dimension TAB_DEFAULT_SIZE = new Dimension(500, 300);
@NotNull
public XCreator createXCreator(Widget creatorSource, String shareId, SharableWidgetProvider provider) {
XCreator xCreator = null;
if (creatorSource instanceof WCardMainBorderLayout) {
xCreator = XCreatorUtils.createXCreator(creatorSource, TAB_DEFAULT_SIZE);
} else {
xCreator = XCreatorUtils.createXCreator(creatorSource, new Dimension(provider.getWidth(), provider.getHeight()));
}
xCreator.setBackupBound(new Rectangle(provider.getWidth(), provider.getHeight()));
xCreator.setShareId(shareId);
return xCreator;
}
}
}

38
designer-form/src/test/java/com/fr/design/mainframe/ShareWidgetButtonTest.java

@ -0,0 +1,38 @@
package com.fr.design.mainframe;
import com.fr.chart.chartattr.ChartCollection;
import com.fr.design.designer.creator.XCreator;
import com.fr.form.share.SharableWidgetProvider;
import com.fr.form.ui.ChartEditor;
import com.fr.general.ImageWithSuffix;
import com.fr.invoke.Reflect;
import org.easymock.EasyMock;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PowerMockIgnore;
import org.powermock.modules.junit4.PowerMockRunner;
@RunWith(PowerMockRunner.class)
@PowerMockIgnore({"com.fr.jvm.assist.*", "javax.swing.*"})
public class ShareWidgetButtonTest {
@Test
public void testCreateXCreator() throws Exception {
SharableWidgetProvider provider = EasyMock.mock(SharableWidgetProvider.class);
EasyMock.expect(provider.getWidth()).andReturn(300).anyTimes();
EasyMock.expect(provider.getHeight()).andReturn(400).anyTimes();
EasyMock.expect(provider.getName()).andReturn("test-drag").anyTimes();
EasyMock.expect(provider.getCover()).andReturn(new ImageWithSuffix("utf-8")).anyTimes();
EasyMock.replay(provider);
ShareWidgetButton.ShareWidgetUI ui = new ShareWidgetButton.ShareWidgetUI();
ChartEditor editor = new ChartEditor();
Reflect.on(editor).set("chartCollection", new ChartCollection());
XCreator xCreator = ui.createXCreator(editor, "333", provider);
Assert.assertEquals(300, xCreator.getWidth());
Assert.assertEquals(400, xCreator.getHeight());
}
}

10
designer-realize/src/main/java/com/fr/design/cell/editor/RichTextToolBar.java

@ -256,8 +256,11 @@ public class RichTextToolBar extends BasicPane{
@Override
public void actionPerformed(ActionEvent e) {
boolean isSub = RichTextToolBar.this.subPane.isSelected();
// 调用setCharacterAttributes函数设置文本区选择文本的字体
MutableAttributeSet attr = new SimpleAttributeSet();
if (!isSub && RichTextToolBar.this.superPane.isSelected()) {
StyleConstants.setSuperscript(attr, false);
}
// 调用setCharacterAttributes函数设置文本区选择文本的字体
StyleConstants.setSubscript(attr, !isSub);
setCharacterAttributes(RichTextToolBar.this.textPane, attr, false);
}
@ -269,6 +272,9 @@ public class RichTextToolBar extends BasicPane{
boolean isSuper = RichTextToolBar.this.superPane.isSelected();
// 调用setCharacterAttributes函数设置文本区选择文本的字体
MutableAttributeSet attr = new SimpleAttributeSet();
if (!isSuper && RichTextToolBar.this.subPane.isSelected()) {
StyleConstants.setSubscript(attr, false);
}
StyleConstants.setSuperscript(attr, !isSuper);
setCharacterAttributes(RichTextToolBar.this.textPane, attr, false);
}
@ -402,7 +408,7 @@ public class RichTextToolBar extends BasicPane{
bold.setSelected(isBold);
italic.setSelected(isItalic);
underline.setSelected(isUnderline);
subPane.setSelected(isSubscript);
subPane.setSelected(isSuperscript ? false : isSubscript);
superPane.setSelected(isSuperscript);
//为什么字体名称, 大小, 颜色, 不需要去判断是否全相同呢
//因为如果全相同, 则设置为第一个字符的样式, 如果不全相同, 那么默认也设置成第一个字符的样式.

2
designer-realize/src/main/java/com/fr/design/mainframe/SheetNameTabPane.java

@ -945,7 +945,7 @@ public class SheetNameTabPane extends JComponent implements MouseListener, Mouse
// marks:判断是否重名
boolean isExisted = false;
for (int i = 0; i < reportComposite.getEditingWorkBook().getReportCount(); i++) {
if (newName.equalsIgnoreCase(reportComposite.getEditingWorkBook().getReportName(i))) {
if (newName.equalsIgnoreCase(reportComposite.getEditingWorkBook().getReportName(i)) && i != selectedIndex) {
isExisted = true;
break;
}

17
designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellFormulaQuickEditor.java

@ -9,7 +9,6 @@ import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.formula.FormulaFactory;
import com.fr.design.formula.UIFormula;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
@ -20,6 +19,7 @@ import com.fr.grid.selection.CellSelection;
import com.fr.quickeditor.CellQuickEditor;
import com.fr.report.ReportHelper;
import com.fr.report.cell.DefaultTemplateCellElement;
import com.fr.report.cell.TemplateCellElement;
import com.fr.stable.ColumnRow;
import com.fr.stable.StringUtils;
@ -56,6 +56,9 @@ public class CellFormulaQuickEditor extends CellQuickEditor {
//默认值
private static final String DEFAULT_FORMULA = "=";
//正在编辑的单元格
private TemplateCellElement editingCellElement;
private DocumentListener documentListener = new DocumentListener() {
@Override
public void insertUpdate(DocumentEvent e) {
@ -102,19 +105,27 @@ public class CellFormulaQuickEditor extends CellQuickEditor {
formulaButton.setPreferredSize(new Dimension(20, formulaTextField.getPreferredSize().height));
formulaButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
String text = formulaTextField.getText();
final UIFormula formulaPane = FormulaFactory.createFormulaPaneWhenReserveFormula();
CellSelection cellSelection = (CellSelection) tc.getSelection();
editingCellElement = tc.getEditingElementCase().getTemplateCellElement(cellSelection.getColumn(), cellSelection.getRow());
Object object = editingCellElement.getValue();
if (object instanceof BaseFormula) {
formulaPane.populate((BaseFormula) object);
} else {
String text = formulaTextField.getText();
formulaPane.populate(BaseFormula.createFormulaBuilder().build(text));
}
formulaPane.showLargeWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() {
@Override
public void doOk() {
BaseFormula fm = formulaPane.update();
if (fm.getContent().length() <= 1) {
fm.setContent(DEFAULT_FORMULA);
formulaTextField.setText(DEFAULT_FORMULA);
} else {
formulaTextField.setText(fm.getContent());
}
editingCellElement.setValue(fm);
}
}).setVisible(true);
}

Loading…
Cancel
Save