Browse Source

Pull request #2025: CHART-14999 && CHART-14811 && CHART-15010 新建图表去掉标题图例工具栏 && 自动推荐时间判断 && 组合地图面板调整

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

* commit '5340b0f3b53a0a9f0d13a5adc5f36fa798a1ed02':
  CHART-15010
  CHART-14999 && CHART-14811 && CHART-15010	 新建图表去掉标题图例工具栏 && 自动推荐时间判断 && 组合地图面板调整
feature/big-screen
Bjorn 4 years ago
parent
commit
ca74cc6914
  1. 10
      designer-chart/src/main/java/com/fr/design/chart/ChartTypePane.java
  2. 31
      designer-chart/src/main/java/com/fr/design/chart/auto/AutoTypeCalculate.java
  3. 4
      designer-chart/src/main/java/com/fr/van/chart/gauge/VanChartGaugeSeriesPane.java
  4. 3
      designer-chart/src/main/java/com/fr/van/chart/map/VanChartMapSeriesPane.java

10
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.ListCellRenderer;
import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener; import javax.swing.event.ListSelectionListener;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.awt.Color; import java.awt.Color;
import java.awt.Component; import java.awt.Component;
@ -35,6 +37,8 @@ public class ChartTypePane extends ChartCommonWizardPane implements CallbackEven
private JList iconViewList = null; private JList iconViewList = null;
private DefaultListModel iconListModel = null; private DefaultListModel iconListModel = null;
private static Map<ChartProvider, ChartProvider> map = new ConcurrentHashMap();
public ChartTypePane() { public ChartTypePane() {
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
DefaultListModel defaultListModel = new DefaultListModel(); DefaultListModel defaultListModel = new DefaultListModel();
@ -102,7 +106,11 @@ public class ChartTypePane extends ChartCommonWizardPane implements CallbackEven
ChartTypePane.this.iconListModel.clear(); ChartTypePane.this.iconListModel.clear();
for (int i = 0, len = charts.length; i < len; i++) { for (int i = 0, len = charts.length; i < len; i++) {
ChartProvider chart = charts[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 chartIcon = new ChartIcon(chartCollection);
chartIcon.setChartName(subName[i]); chartIcon.setChartName(subName[i]);
chartIcon.registerCallBackEvent(ChartTypePane.this); chartIcon.registerCallBackEvent(ChartTypePane.this);

31
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.ArrayList;
import java.util.List; import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/** /**
* @author Bjorn * @author Bjorn
@ -30,6 +32,15 @@ import java.util.List;
*/ */
public class AutoTypeCalculate { 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<VanChart> calculateType(String tableName, List<String> columns) { public static List<VanChart> calculateType(String tableName, List<String> columns) {
List<ColumnInfo> columnValue = calculateField(tableName, columns); List<ColumnInfo> columnValue = calculateField(tableName, columns);
if (columnValue.isEmpty()) { if (columnValue.isEmpty()) {
@ -86,9 +97,29 @@ public class AutoTypeCalculate {
return false; return false;
} }
} }
//不是日期型数字才是指标
return !isNumberData(values);
}
private static boolean isNumberData(List<String> values) {
for (String value : values) {
if (!isNumberData(value)) {
return false;
}
}
return true; 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<ColumnInfo> calculateField(String tableName, List<String> columns) { private static List<ColumnInfo> calculateField(String tableName, List<String> columns) {
NameTableData nameTableData = new NameTableData(tableName); NameTableData nameTableData = new NameTableData(tableName);
TableDataSource dataSource = TableDataSourceTailor.extractTableData(HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().getTarget()); TableDataSource dataSource = TableDataSourceTailor.extractTableData(HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().getTarget());

4
designer-chart/src/main/java/com/fr/van/chart/gauge/VanChartGaugeSeriesPane.java

@ -69,7 +69,7 @@ public class VanChartGaugeSeriesPane extends VanChartAbstractPlotSeriesPane {
new Component[]{createGaugeBandsPane()} new Component[]{createGaugeBandsPane()}
}; };
return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
} }
private JPanel createGaugeLayoutPane() { private JPanel createGaugeLayoutPane() {
@ -311,4 +311,4 @@ public class VanChartGaugeSeriesPane extends VanChartAbstractPlotSeriesPane {
protected VanChartBeautyPane createStylePane() { protected VanChartBeautyPane createStylePane() {
return null; return null;
} }
} }

3
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)); markerTypeCom.setModel(new DefaultComboBoxModel(largeModel ? LARGE_MARKER_TYPES : MARKER_TYPES));
if (ComparatorUtils.equals(MapMarkerType.IMAGE.toLocalString(), selectedItem) && largeModel) { if (ComparatorUtils.equals(MapMarkerType.IMAGE.toLocalString(), selectedItem) && largeModel) {
markerTypeCom.setSelectedItem(MapMarkerType.COMMON.toLocalString()); markerTypeCom.setSelectedItem(MapMarkerType.COMMON.toLocalString());
}else{ } else {
markerTypeCom.setSelectedItem(selectedItem); markerTypeCom.setSelectedItem(selectedItem);
} }
} }
@ -380,6 +380,7 @@ public class VanChartMapSeriesPane extends VanChartColorValueSeriesPane {
} else { } else {
panel = createMapCustomGroupPane(areaPane, pointPane, linePane); panel = createMapCustomGroupPane(areaPane, pointPane, linePane);
} }
panel.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0));
return panel; return panel;
} }

Loading…
Cancel
Save