Browse Source
* commit '2c716717a9a90f30c6ef1c78cd6ccb0939e6bd16': REPORT-43833 【10.0.14】远程设计数据连接/服务器数据集增加锁定 【问题原因】在设计器启动的过程中,UILockButton会调用isLocked方法,此时工作空间对象池中还没有对象,因此获取到的operator是null,会报npe 【改动方案】做个判断 CHART-17983 仪表盘目标值默认 && CHART-18024 数据集改变,监听重复导致结果错误 CHART-18050 使用双列网格布局代替流式布局,补充国际化 CHART-18050 富文本弹窗界面设置为可拖拽大小 CHART-17775 删除无用方法 CHART-18006 design 插件 提示下载地图资源 CHART-17775 像素 & 百分比控件优化 CHART-17231 默认不选中任何项bugfix/10.0
superman
4 years ago
47 changed files with 448 additions and 158 deletions
@ -0,0 +1,24 @@
|
||||
package com.fr.design.gui.frpane; |
||||
|
||||
import com.fr.design.gui.ispinner.UISpinner; |
||||
import com.fr.design.gui.ispinner.chart.UISpinnerWithPercent; |
||||
|
||||
/** |
||||
* @author Bjorn |
||||
* @version 10.0 |
||||
* Created by Bjorn on 2021-01-21 |
||||
*/ |
||||
public class UINumberDragPaneWithPercent extends UINumberDragPane { |
||||
|
||||
public UINumberDragPaneWithPercent(double minValue, double maxValue) { |
||||
super(minValue, maxValue); |
||||
} |
||||
|
||||
public UINumberDragPaneWithPercent(double minValue, double maxValue, double dierta) { |
||||
super(minValue, maxValue, dierta); |
||||
} |
||||
|
||||
protected UISpinner createUISpinner(double minValue, double maxValue, double dierta) { |
||||
return new UISpinnerWithPercent(minValue, maxValue, dierta, minValue); |
||||
} |
||||
} |
@ -0,0 +1,15 @@
|
||||
package com.fr.design.gui.ispinner.chart; |
||||
|
||||
/** |
||||
* @author Bjorn |
||||
* @version 10.0 |
||||
* Created by Bjorn on 2021-01-21 |
||||
*/ |
||||
public class UISpinnerWithPercent extends UISpinnerWithUnit { |
||||
|
||||
private static final String UNIT = "%"; |
||||
|
||||
public UISpinnerWithPercent(double minValue, double maxValue, double dierta, double defaultValue) { |
||||
super(minValue, maxValue, dierta, defaultValue, UNIT); |
||||
} |
||||
} |
@ -0,0 +1,20 @@
|
||||
package com.fr.design.gui.ispinner.chart; |
||||
|
||||
/** |
||||
* @author Bjorn |
||||
* @version 10.0 |
||||
* Created by Bjorn on 2021-01-21 |
||||
*/ |
||||
public class UISpinnerWithPx extends UISpinnerWithUnit { |
||||
|
||||
private static final String UNIT = "px"; |
||||
|
||||
public UISpinnerWithPx(double defaultValue) { |
||||
this(0, Double.MAX_VALUE, 1, defaultValue); |
||||
} |
||||
|
||||
public UISpinnerWithPx(double minValue, double maxValue, double dierta, double defaultValue) { |
||||
super(minValue, maxValue, dierta, defaultValue, UNIT); |
||||
this.getTextField().canFillNegativeNumber(false); |
||||
} |
||||
} |
@ -0,0 +1,26 @@
|
||||
package com.fr.design.gui.ispinner.chart; |
||||
|
||||
import com.fr.design.gui.ispinner.UISpinner; |
||||
import com.fr.design.gui.itextfield.UINumberField; |
||||
import com.fr.design.gui.itextfield.UINumberFieldWithUnit; |
||||
|
||||
/** |
||||
* @author Bjorn |
||||
* @version 10.0 |
||||
* Created by Bjorn on 2021-01-20 |
||||
*/ |
||||
public class UISpinnerWithUnit extends UISpinner { |
||||
|
||||
private String unit; |
||||
|
||||
public UISpinnerWithUnit(double minValue, double maxValue, double dierta, double defaultValue, String unit) { |
||||
this.unit = unit; |
||||
init(minValue, maxValue, dierta); |
||||
getTextField().setValue(defaultValue); |
||||
} |
||||
|
||||
@Override |
||||
protected UINumberField initNumberField() { |
||||
return new UINumberFieldWithUnit(3, unit); |
||||
} |
||||
} |
@ -0,0 +1,114 @@
|
||||
package com.fr.design.gui.itextfield; |
||||
|
||||
import com.fr.base.Utils; |
||||
import com.fr.general.ComparatorUtils; |
||||
import com.fr.stable.StringUtils; |
||||
|
||||
import java.util.ArrayList; |
||||
import java.util.Collections; |
||||
import java.util.Comparator; |
||||
import java.util.LinkedHashSet; |
||||
import java.util.List; |
||||
import java.util.Set; |
||||
import java.awt.Toolkit; |
||||
|
||||
/** |
||||
* @author Bjorn |
||||
* @version 10.0 |
||||
* Created by Bjorn on 2021-01-20 |
||||
* 这个控件不会限制输入的数字大小,但是同样不允许输入数字之外的字符 |
||||
*/ |
||||
public class UINumberFieldWithUnit extends UINumberField { |
||||
|
||||
private String unit; |
||||
|
||||
private List<String> unitList = new ArrayList<>(); |
||||
|
||||
public UINumberFieldWithUnit(int columns, String unit) { |
||||
super(columns); |
||||
this.unit = unit; |
||||
initUnitList(); |
||||
} |
||||
|
||||
//对单位的字符进行组合
|
||||
private void initUnitList() { |
||||
char[] chars = unit.toCharArray(); |
||||
Set<String> set = new LinkedHashSet<>(); |
||||
initUnitList(chars, 0, StringUtils.EMPTY, set); |
||||
unitList.addAll(set); |
||||
Collections.sort(unitList, Comparator.comparing(String::length)); |
||||
} |
||||
|
||||
private void initUnitList(char[] chars, int index, String str, Set<String> set) { |
||||
if (index == chars.length) { |
||||
return; |
||||
} |
||||
for (int i = index; i < chars.length; i++) { |
||||
String newStr = str + chars[i]; |
||||
set.add(newStr); |
||||
initUnitList(chars, i + 1, newStr, set); |
||||
} |
||||
} |
||||
|
||||
public void setFieldDocument() { |
||||
setDocument(new NumberDocumentNoLimit()); |
||||
} |
||||
|
||||
public void setValue(double value) { |
||||
this.setText(Utils.doubleToString(value) + unit); |
||||
} |
||||
|
||||
public double getValue() throws NumberFormatException { |
||||
try { |
||||
String text = this.getText(); |
||||
if (StringUtils.isEmpty(text)) { |
||||
return 0; |
||||
} |
||||
|
||||
return Double.parseDouble(text.replace(getEndString(text), StringUtils.EMPTY)); |
||||
} catch (NumberFormatException numberFormatException) { |
||||
return UINumberField.ERROR_VALUE; |
||||
} |
||||
} |
||||
|
||||
private String getEndString(String text) { |
||||
int size = unitList.size(); |
||||
for (int i = size - 1; i >= 0; i--) { |
||||
String unit = unitList.get(i); |
||||
if (text.endsWith(unit)) { |
||||
return unit; |
||||
|
||||
} |
||||
} |
||||
return StringUtils.EMPTY; |
||||
} |
||||
|
||||
class NumberDocumentNoLimit extends NumberDocument { |
||||
|
||||
public boolean checkString(int offset, String s, String str) { |
||||
return (ComparatorUtils.equals(s, "F") |
||||
|| ComparatorUtils.equals(s, "f") |
||||
|| ComparatorUtils.equals(s, "D") |
||||
|| ComparatorUtils.equals(s, "d") |
||||
|| (ComparatorUtils.equals(s, ".") && getMaxDecimalLength() == 0)); |
||||
|
||||
} |
||||
|
||||
protected boolean isOverMaxOrMinValue(String strIntPart, String strDecPart, String strNew) { |
||||
return super.isOverMaxOrMinValue(strIntPart, strDecPart, strNew.replaceFirst(getEndString(strNew), StringUtils.EMPTY)); |
||||
} |
||||
|
||||
protected boolean checkNumber(String strValue, boolean isMinus) { |
||||
try { |
||||
if (ComparatorUtils.equals(strValue, StringUtils.EMPTY) || ComparatorUtils.equals(strValue, "-")) { |
||||
return false; |
||||
} |
||||
Double.parseDouble(strValue.replaceFirst(getEndString(strValue), StringUtils.EMPTY)); |
||||
} catch (Exception e) { |
||||
Toolkit.getDefaultToolkit().beep(); |
||||
return true; |
||||
} |
||||
return false; |
||||
} |
||||
} |
||||
} |
Loading…
Reference in new issue