diff --git a/designer-chart/src/main/java/com/fr/design/chart/ChartTypePane.java b/designer-chart/src/main/java/com/fr/design/chart/ChartTypePane.java index aab17780e2..a5937c1d9d 100644 --- a/designer-chart/src/main/java/com/fr/design/chart/ChartTypePane.java +++ b/designer-chart/src/main/java/com/fr/design/chart/ChartTypePane.java @@ -23,6 +23,8 @@ import javax.swing.JSplitPane; import javax.swing.ListCellRenderer; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; import java.awt.Color; import java.awt.Component; @@ -35,6 +37,8 @@ public class ChartTypePane extends ChartCommonWizardPane implements CallbackEven private JList iconViewList = null; private DefaultListModel iconListModel = null; + private static Map map = new ConcurrentHashMap(); + public ChartTypePane() { this.setLayout(FRGUIPaneFactory.createBorderLayout()); DefaultListModel defaultListModel = new DefaultListModel(); @@ -102,7 +106,11 @@ public class ChartTypePane extends ChartCommonWizardPane implements CallbackEven ChartTypePane.this.iconListModel.clear(); for (int i = 0, len = charts.length; i < len; i++) { ChartProvider chart = charts[i]; - ChartCollection chartCollection = new ChartCollection(chart); + if (map.get(chart) == null) { + ChartProvider chartProvider = chart.transformProperties(); + map.put(chart, chartProvider); + } + ChartCollection chartCollection = new ChartCollection(map.get(chart)); ChartIcon chartIcon = new ChartIcon(chartCollection); chartIcon.setChartName(subName[i]); chartIcon.registerCallBackEvent(ChartTypePane.this); diff --git a/designer-chart/src/main/java/com/fr/design/chart/auto/AutoTypeCalculate.java b/designer-chart/src/main/java/com/fr/design/chart/auto/AutoTypeCalculate.java index db20af8cfb..c30679e0ee 100644 --- a/designer-chart/src/main/java/com/fr/design/chart/auto/AutoTypeCalculate.java +++ b/designer-chart/src/main/java/com/fr/design/chart/auto/AutoTypeCalculate.java @@ -22,6 +22,8 @@ import com.fr.stable.StringUtils; import java.util.ArrayList; import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; /** * @author Bjorn @@ -30,6 +32,15 @@ import java.util.List; */ public class AutoTypeCalculate { + public static Pattern[] dataPatterns; + + static { + Pattern pattern1 = Pattern.compile("^(19|20)\\d{2}$"); + Pattern pattern2 = Pattern.compile("^\\d{4}(0?[1-9]|1[012])$"); + Pattern pattern3 = Pattern.compile("^\\d{4}(0?[1-9]|1[012])(0?[1-9]|[12]\\d|3[01])$"); + dataPatterns = new Pattern[]{pattern1, pattern2, pattern3}; + } + public static List calculateType(String tableName, List columns) { List columnValue = calculateField(tableName, columns); if (columnValue.isEmpty()) { @@ -86,9 +97,29 @@ public class AutoTypeCalculate { return false; } } + //不是日期型数字才是指标 + return !isNumberData(values); + } + + private static boolean isNumberData(List values) { + for (String value : values) { + if (!isNumberData(value)) { + return false; + } + } return true; } + private static boolean isNumberData(String value) { + for (Pattern pattern : dataPatterns) { + Matcher matcher = pattern.matcher(value); + if (matcher.matches()) { + return true; + } + } + return false; + } + private static List calculateField(String tableName, List columns) { NameTableData nameTableData = new NameTableData(tableName); TableDataSource dataSource = TableDataSourceTailor.extractTableData(HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().getTarget()); diff --git a/designer-chart/src/main/java/com/fr/van/chart/gauge/VanChartGaugeSeriesPane.java b/designer-chart/src/main/java/com/fr/van/chart/gauge/VanChartGaugeSeriesPane.java index 858fb0ae72..af7aaf0014 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/gauge/VanChartGaugeSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/gauge/VanChartGaugeSeriesPane.java @@ -69,7 +69,7 @@ public class VanChartGaugeSeriesPane extends VanChartAbstractPlotSeriesPane { new Component[]{createGaugeBandsPane()} }; - return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); + return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); } private JPanel createGaugeLayoutPane() { @@ -311,4 +311,4 @@ public class VanChartGaugeSeriesPane extends VanChartAbstractPlotSeriesPane { protected VanChartBeautyPane createStylePane() { return null; } -} +} \ No newline at end of file diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/VanChartMapSeriesPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/VanChartMapSeriesPane.java index 925cb96c8d..bf44ded481 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/map/VanChartMapSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/map/VanChartMapSeriesPane.java @@ -158,7 +158,7 @@ public class VanChartMapSeriesPane extends VanChartColorValueSeriesPane { markerTypeCom.setModel(new DefaultComboBoxModel(largeModel ? LARGE_MARKER_TYPES : MARKER_TYPES)); if (ComparatorUtils.equals(MapMarkerType.IMAGE.toLocalString(), selectedItem) && largeModel) { markerTypeCom.setSelectedItem(MapMarkerType.COMMON.toLocalString()); - }else{ + } else { markerTypeCom.setSelectedItem(selectedItem); } } @@ -380,6 +380,7 @@ public class VanChartMapSeriesPane extends VanChartColorValueSeriesPane { } else { panel = createMapCustomGroupPane(areaPane, pointPane, linePane); } + panel.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0)); return panel; }