Browse Source

Merge pull request #2569 in DESIGN/design from bugfix/10.0 to feature/10.0

* commit '6477d9b13b92aa983e85d31dfaa8ca00c82a5141':
  CHART-15968 解决标签界面属性保存错误
  REPORT-40969 数据集-数据库数据集-重命名有问题
  REPORT-38514 标签控件的属性界面-字体大小显示异常 【问题原因】标签属性界面,跟字体有关的一块由FRFontPane控制,这个界面表示字体大小的fontSizeComboBox会将接收到的值转化为浮点数而不是整数,变成浮点数之后会出现显示不全的情况 【改动思路】17年Momeak的一个改动(无JIRA任务)将字体大小从整数修改为浮点数,考虑到这一点,不采取改回整数的修改方案,而是将fontSizeComboBox与前一个组件之间的间隙减小,TableLayout下fontSizeComboBox就会被自动拉长,拉长后能够完整显示字体大小,改动效果已经通过产品确认
research/11.0
superman 4 years ago
parent
commit
863fce65ac
  1. 16
      designer-base/src/main/java/com/fr/design/data/datapane/TableDataPaneListPane.java
  2. 7
      designer-base/src/main/java/com/fr/design/gui/controlpane/JListControlPane.java
  3. 25
      designer-base/src/main/java/com/fr/design/gui/style/FRFontPane.java
  4. 2
      designer-base/src/test/java/com/fr/design/data/datapane/TableDataPaneListPaneTest.java
  5. 5
      designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartLabelPane.java
  6. 4
      designer-form/src/main/java/com/fr/design/widget/ui/designer/LabelDefinePane.java

16
designer-base/src/main/java/com/fr/design/data/datapane/TableDataPaneListPane.java

@ -24,11 +24,13 @@ import com.fr.stable.core.PropertyChangeAdapter;
import javax.swing.*; import javax.swing.*;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set;
/** /**
* TableDataList Pane. * TableDataList Pane.
@ -49,8 +51,7 @@ public class TableDataPaneListPane extends JListControlPane implements TableData
//说明双击之后又取消了,啥也不用做 //说明双击之后又取消了,啥也不用做
return; return;
} }
TableDataSource source = DesignTableDataManager.getEditingTableDataSource(); Set<String> allDSNames = DesignTableDataManager.getGlobalDataSet().keySet();
String[] allDSNames = DesignTableDataManager.getAllDSNames(source);
String[] allListNames = nameableList.getAllNames(); String[] allListNames = nameableList.getAllNames();
allListNames[editingIndex] = StringUtils.EMPTY; allListNames[editingIndex] = StringUtils.EMPTY;
@ -73,7 +74,7 @@ public class TableDataPaneListPane extends JListControlPane implements TableData
setIllegalIndex(editingIndex); setIllegalIndex(editingIndex);
return; return;
} }
boolean isRepeated = isNameRepeated(new List[]{Arrays.asList(allDSNames), Arrays.asList(allListNames)}, tempName); boolean isRepeated = isNameRepeated(new Collection[]{allDSNames, Arrays.asList(allListNames)}, tempName);
if (isRepeated) { if (isRepeated) {
isNamePermitted = false; isNamePermitted = false;
nameableList.stopEditing(); nameableList.stopEditing();
@ -98,10 +99,15 @@ public class TableDataPaneListPane extends JListControlPane implements TableData
for (Map.Entry<String, String> entry : dsNameChangedMap.entrySet()) { for (Map.Entry<String, String> entry : dsNameChangedMap.entrySet()) {
if (StringUtils.equals(oldName, entry.getValue())) { if (StringUtils.equals(oldName, entry.getValue())) {
oldName = entry.getKey(); oldName = entry.getKey();
break;
} }
} }
if (StringUtils.equals(oldName, newName)) {
dsNameChangedMap.put(oldName, newName); //a -> b;b -> a,说明没改
dsNameChangedMap.remove(oldName);
} else {
dsNameChangedMap.put(oldName, newName);
}
} }
/** /**

7
designer-base/src/main/java/com/fr/design/gui/controlpane/JListControlPane.java

@ -27,6 +27,7 @@ import java.awt.Component;
import java.awt.event.MouseAdapter; import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.awt.event.MouseListener; import java.awt.event.MouseListener;
import java.util.Collection;
public abstract class JListControlPane extends JControlPane implements ListControlPaneProvider { public abstract class JListControlPane extends JControlPane implements ListControlPaneProvider {
private static final String LIST_NAME = "JControl_List"; private static final String LIST_NAME = "JControl_List";
@ -190,9 +191,9 @@ public abstract class JListControlPane extends JControlPane implements ListContr
return getHelper().getSelectedName(); return getHelper().getSelectedName();
} }
protected boolean isNameRepeated(java.util.List[] list, String name) { protected boolean isNameRepeated(Collection[] collections, String name) {
for (int i = 0; i < list.length; i++) { for (int i = 0; i < collections.length; i++) {
if (list[i].contains(name)) { if (collections[i].contains(name)) {
isNameRepeated = true; isNameRepeated = true;
return true; return true;
} }

25
designer-base/src/main/java/com/fr/design/gui/style/FRFontPane.java

@ -25,10 +25,20 @@ import com.fr.general.FRFont;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import javax.swing.*; import javax.swing.BorderFactory;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
import java.awt.*; import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.GridLayout;
import java.awt.RenderingHints;
import java.awt.event.MouseAdapter; import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.util.Vector; import java.util.Vector;
@ -67,11 +77,20 @@ public class FRFontPane extends AbstractBasicStylePane implements GlobalNameObse
private UIToggleButton subPane; private UIToggleButton subPane;
private JPanel linePane; private JPanel linePane;
private int italic_bold; private int italic_bold;
/**
* LeftPane和RightPane之间的间隙也是fontSizeStyleComboBox与fontSizeComboBox之间的间隙之前的默认值为VGAP_LARGE
*/
private int hGapBetweenLeftPaneAndRightPane = LayoutConstants.VGAP_LARGE;
public FRFontPane() { public FRFontPane() {
this.initComponents(); this.initComponents();
} }
public FRFontPane(int hGapBetweenLeftPaneAndRightPane) {
this.hGapBetweenLeftPaneAndRightPane = hGapBetweenLeftPaneAndRightPane;
this.initComponents();
}
public static void main(String[] args) { public static void main(String[] args) {
JFrame jf = new JFrame("test"); JFrame jf = new JFrame("test");
jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
@ -345,7 +364,7 @@ public class FRFontPane extends AbstractBasicStylePane implements GlobalNameObse
private JPanel createPane() { private JPanel createPane() {
JPanel createPane = new JPanel(new BorderLayout()); JPanel createPane = new JPanel(new BorderLayout());
createPane.add(fontNameComboBox, BorderLayout.NORTH); createPane.add(fontNameComboBox, BorderLayout.NORTH);
JPanel jPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{createLeftPane(), createRightPane()}}, TableLayoutHelper.FILL_LASTCOLUMN, LayoutConstants.VGAP_LARGE, LayoutConstants.VGAP_LARGE); JPanel jPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{createLeftPane(), createRightPane()}}, TableLayoutHelper.FILL_LASTCOLUMN, hGapBetweenLeftPaneAndRightPane, LayoutConstants.VGAP_LARGE);
jPanel.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); jPanel.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
createPane.add(jPanel, BorderLayout.CENTER); createPane.add(jPanel, BorderLayout.CENTER);
return createPane; return createPane;

2
designer-base/src/test/java/com/fr/design/data/datapane/TableDataPaneListPaneTest.java

@ -20,5 +20,7 @@ public class TableDataPaneListPaneTest {
listPane.rename("222", "333"); listPane.rename("222", "333");
Map<String, String> dsNameChangedMap = listPane.getDsNameChangedMap(); Map<String, String> dsNameChangedMap = listPane.getDsNameChangedMap();
assertEquals(1, dsNameChangedMap.size()); assertEquals(1, dsNameChangedMap.size());
listPane.rename("333","111");
assertEquals(0, dsNameChangedMap.size());
} }
} }

5
designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartLabelPane.java

@ -64,11 +64,14 @@ public class VanChartLabelPane extends AbstractVanChartScrollPane<Chart> {
return; return;
} }
ConditionAttr attrList = chart.getPlot().getConditionCollection().getDefaultAttr(); ConditionAttr attrList = chart.getPlot().getConditionCollection().getDefaultAttr();
// labelPane中颜色选择器会触发listener.doChange(),导致style界面update两次,
// 为了避免递归updateBean时,remove与add不匹配,调整一下labelPane.update()的位置
AttrLabel attrLabel = labelPane.update();
DataSeriesCondition attr = ((VanChartPlot)chart.getPlot()).getAttrLabelFromConditionCollection(); DataSeriesCondition attr = ((VanChartPlot)chart.getPlot()).getAttrLabelFromConditionCollection();
if(attr != null) { if(attr != null) {
attrList.remove(attr); attrList.remove(attr);
} }
AttrLabel attrLabel = labelPane.update();
if (attrLabel != null) { if (attrLabel != null) {
attrList.addDataSeriesCondition(attrLabel); attrList.addDataSeriesCondition(attrLabel);
} }

4
designer-form/src/main/java/com/fr/design/widget/ui/designer/LabelDefinePane.java

@ -1,6 +1,7 @@
package com.fr.design.widget.ui.designer; package com.fr.design.widget.ui.designer;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.designer.IntervalConstants; import com.fr.design.designer.IntervalConstants;
import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XCreator;
import com.fr.design.foldablepane.UIExpandablePane; import com.fr.design.foldablepane.UIExpandablePane;
@ -58,7 +59,8 @@ public class LabelDefinePane extends AbstractDataModify<Label> {
hAlignmentPane = new UIButtonGroup<Integer>(hAlignmentIconArray, hAlignment); hAlignmentPane = new UIButtonGroup<Integer>(hAlignmentIconArray, hAlignment);
hAlignmentPane.setAllToolTips(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_StyleAlignment_Left") hAlignmentPane.setAllToolTips(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_StyleAlignment_Left")
, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_StyleAlignment_Center"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_StyleAlignment_Right")}); , com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_StyleAlignment_Center"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_StyleAlignment_Right")});
frFontPane = new FRFontPane(); // 字体大小是浮点数,因为涉及很多字体计算,不太好修改,为了完整显示字体,将FRFontPane中的fontSizeComboBox拉长一点
frFontPane = new FRFontPane(LayoutConstants.VGAP_MEDIUM);
double f = TableLayout.FILL; double f = TableLayout.FILL;
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double[] rowSize = {p, p, p, p, p, p, p}; double[] rowSize = {p, p, p, p, p, p, p};

Loading…
Cancel
Save