137 changed files with 2753 additions and 2128 deletions
@ -1,73 +0,0 @@
|
||||
package com.fr.design.formula; |
||||
|
||||
import com.fr.base.BaseFormula; |
||||
import com.fr.design.gui.itextfield.DictionaryTextField; |
||||
import com.fr.stable.StringUtils; |
||||
|
||||
import javax.swing.text.Document; |
||||
|
||||
/** |
||||
* 公式展示时使用。 |
||||
* 展示 String. |
||||
* 但实际保存的是 BaseFormula。 |
||||
* 从而保留公式的形态。 |
||||
* |
||||
* created by Harrison on 2020/08/03 |
||||
**/ |
||||
public class FormulaTextField extends DictionaryTextField<BaseFormula> { |
||||
|
||||
private static final BaseFormula EMPTY_FORMULA = BaseFormula.createFormulaBuilder().build("="); |
||||
|
||||
public FormulaTextField() { |
||||
} |
||||
|
||||
public FormulaTextField(int columns) { |
||||
super(columns); |
||||
} |
||||
|
||||
public FormulaTextField(String text, int columns, BaseFormula value) { |
||||
super(text, columns, value); |
||||
} |
||||
|
||||
public FormulaTextField(String text, BaseFormula value) { |
||||
super(text, value); |
||||
} |
||||
|
||||
public FormulaTextField(Document doc, String text, int columns, BaseFormula value) { |
||||
super(doc, text, columns, value); |
||||
} |
||||
|
||||
@Override |
||||
public BaseFormula getValue() { |
||||
|
||||
if (this.value == null) { |
||||
this.value = createDefault(); |
||||
} |
||||
return this.value; |
||||
} |
||||
|
||||
/** |
||||
* 设置值时,会将展示的公式值一同设置进去 |
||||
* |
||||
* @param value 公式值 |
||||
*/ |
||||
@Override |
||||
public void setValue(BaseFormula value) { |
||||
|
||||
this.value = value; |
||||
if (this.value == null) { |
||||
this.value = createDefault(); |
||||
} |
||||
setText(this.value.getPureContent()); |
||||
} |
||||
|
||||
private BaseFormula createDefault() { |
||||
|
||||
String text = getText(); |
||||
if (StringUtils.isNotEmpty(text)) { |
||||
return BaseFormula.createFormulaBuilder().build(text); |
||||
} else { |
||||
return EMPTY_FORMULA; |
||||
} |
||||
} |
||||
} |
@ -1,45 +0,0 @@
|
||||
package com.fr.design.gui.itextfield; |
||||
|
||||
import javax.swing.text.Document; |
||||
|
||||
/** |
||||
* 文字 ui. |
||||
* 保存实际值,展示值。 |
||||
* 允许实际值和展示值不同。 |
||||
* |
||||
* created by Harrison on 2020/08/03 |
||||
**/ |
||||
public class DictionaryTextField<T> extends UITextField { |
||||
|
||||
protected T value; |
||||
|
||||
public DictionaryTextField() { |
||||
} |
||||
|
||||
public DictionaryTextField(int columns) { |
||||
super(columns); |
||||
} |
||||
|
||||
public DictionaryTextField(String text, int columns, T value) { |
||||
super(text, columns); |
||||
this.value = value; |
||||
} |
||||
|
||||
public DictionaryTextField(String text, T value) { |
||||
super(text); |
||||
this.value = value; |
||||
} |
||||
|
||||
public DictionaryTextField(Document doc, String text, int columns, T value) { |
||||
super(doc, text, columns); |
||||
this.value = value; |
||||
} |
||||
|
||||
public T getValue() { |
||||
return value; |
||||
} |
||||
|
||||
public void setValue(T value) { |
||||
this.value = value; |
||||
} |
||||
} |
@ -0,0 +1,61 @@
|
||||
package com.fr.design.utils; |
||||
|
||||
import com.fr.base.Parameter; |
||||
import com.fr.base.ParameterHelper; |
||||
import com.fr.general.ComparatorUtils; |
||||
import com.fr.stable.ArrayUtils; |
||||
|
||||
import java.util.ArrayList; |
||||
import java.util.Arrays; |
||||
import java.util.Iterator; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* @Author: Yuan.Wang |
||||
* @Date: 2020/8/11 |
||||
*/ |
||||
public class ParameterUtils { |
||||
/** |
||||
* 获得新的参数集合,返回的集合中的参数的顺序为:新增参数全部放在后面,以保证原有参数的相对顺序 |
||||
* |
||||
* @param paramTexts sql语句 |
||||
* @param oldParameters 旧的参数集合 |
||||
* @return 新参数集合 |
||||
*/ |
||||
public static Parameter[] analyzeAndUnionParameters(String[] paramTexts, Parameter[] oldParameters) { |
||||
Parameter[] newParameters = ParameterHelper.analyze4Parameters(paramTexts, false); |
||||
return unionParametersInRelativeOrder(oldParameters, newParameters); |
||||
} |
||||
|
||||
/** |
||||
* 合并新旧参数集合,新增参数全部放在后面,以保证原有参数的相对顺序 |
||||
* |
||||
* @param oldParameters 旧的参数集合 |
||||
* @param newParameters 新的参数集合 |
||||
* @return 新参数集合 |
||||
*/ |
||||
private static Parameter[] unionParametersInRelativeOrder(Parameter[] oldParameters, Parameter[] newParameters) { |
||||
if (ArrayUtils.isEmpty(newParameters) || ArrayUtils.isEmpty(oldParameters)) { |
||||
return newParameters; |
||||
} |
||||
|
||||
Parameter[] result = new Parameter[newParameters.length]; |
||||
List<Parameter> newParameterList = new ArrayList<>(Arrays.asList(newParameters)); |
||||
int i = 0; |
||||
//遍历旧参数数组中的参数,如果新参数list中存在同名参数,将该参数加入到result里,同时删除list中的同名参数
|
||||
for (Parameter oldParameter : oldParameters) { |
||||
Iterator<Parameter> iterator = newParameterList.listIterator(); |
||||
while (iterator.hasNext()) { |
||||
Parameter newParameter = iterator.next(); |
||||
if (ComparatorUtils.equals(oldParameter.getName(), newParameter.getName())) { |
||||
result[i++] = oldParameter; |
||||
iterator.remove(); |
||||
break; |
||||
} |
||||
} |
||||
} |
||||
//将新参数list中的剩余参数添加到result中
|
||||
System.arraycopy(newParameterList.toArray(new Parameter[0]), 0, result, i, newParameterList.size()); |
||||
return result; |
||||
} |
||||
} |
@ -0,0 +1,38 @@
|
||||
package com.fr.design.utils; |
||||
|
||||
import com.fr.base.Parameter; |
||||
import junit.framework.TestCase; |
||||
|
||||
/** |
||||
* @Author: Yuan.Wang |
||||
* @Date: 2020/8/11 |
||||
*/ |
||||
public class ParameterUtilsTest extends TestCase { |
||||
public void testAnalyzeAndUnionParameters() { |
||||
String[] paramTexts = {"${a}${b}${d}", ""}; |
||||
Parameter[] oldParameters = new Parameter[]{new Parameter("c"), new Parameter("b"), new Parameter("a")}; |
||||
Parameter[] rightResult = new Parameter[]{new Parameter("b"), new Parameter("a"), new Parameter("d")}; |
||||
Parameter[] result = ParameterUtils.analyzeAndUnionParameters(paramTexts, oldParameters); |
||||
assertEquals(result.length, rightResult.length); |
||||
for (int i = 0; i < rightResult.length; i++) { |
||||
assertEquals(rightResult[i].getName(), result[i].getName()); |
||||
} |
||||
|
||||
paramTexts = new String[]{"${a}${b}${d}", ""}; |
||||
oldParameters = new Parameter[]{}; |
||||
rightResult = new Parameter[]{new Parameter("a"), new Parameter("b"), new Parameter("d")}; |
||||
result = ParameterUtils.analyzeAndUnionParameters(paramTexts, oldParameters); |
||||
assertEquals(result.length,rightResult.length); |
||||
|
||||
paramTexts = new String[]{"${b}", ""}; |
||||
oldParameters = new Parameter[]{new Parameter("b"), new Parameter("a"), new Parameter("d")}; |
||||
rightResult = new Parameter[]{new Parameter("b")}; |
||||
result = ParameterUtils.analyzeAndUnionParameters(paramTexts, oldParameters); |
||||
assertEquals(result.length,rightResult.length); |
||||
assertEquals(result.length, rightResult.length); |
||||
for (int i = 0; i < rightResult.length; i++) { |
||||
assertEquals(rightResult[i].getName(), result[i].getName()); |
||||
} |
||||
|
||||
} |
||||
} |
@ -0,0 +1,69 @@
|
||||
package com.fr.design.chartx.data; |
||||
|
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.design.layout.TableLayout; |
||||
import com.fr.design.layout.TableLayoutHelper; |
||||
|
||||
import javax.swing.BorderFactory; |
||||
import javax.swing.JComponent; |
||||
import javax.swing.JPanel; |
||||
import javax.swing.SwingConstants; |
||||
import java.awt.Component; |
||||
import java.util.Arrays; |
||||
|
||||
/** |
||||
* @author shine |
||||
* @version 10.0 |
||||
* Created by shine on 2020/7/22 |
||||
*/ |
||||
public class DataLayoutHelper { |
||||
|
||||
public static int WIDTH = 150; |
||||
public static int LABEL_HEIGHT = 20; |
||||
public static int LABEL_WIDTH = 65; |
||||
|
||||
public static int LEFT_GAP = 15; |
||||
public static int RIGHT_GAP = 10; |
||||
|
||||
public static void setWIDTH(int WIDTH) { |
||||
DataLayoutHelper.WIDTH = WIDTH; |
||||
} |
||||
|
||||
public static void setLabelHeight(int labelHeight) { |
||||
LABEL_HEIGHT = labelHeight; |
||||
} |
||||
|
||||
public static void setLabelWidth(int labelWidth) { |
||||
LABEL_WIDTH = labelWidth; |
||||
} |
||||
|
||||
public static void setLeftGap(int leftGap) { |
||||
LEFT_GAP = leftGap; |
||||
} |
||||
|
||||
public static void setRightGap(int rightGap) { |
||||
RIGHT_GAP = rightGap; |
||||
} |
||||
|
||||
public static JPanel createDataLayoutPane(Component[][] components) { |
||||
int len = components.length; |
||||
double p = TableLayout.PREFERRED; |
||||
double[] columnSize = {DataLayoutHelper.LABEL_WIDTH, DataLayoutHelper.WIDTH}; |
||||
double[] rowSize = new double[len]; |
||||
Arrays.fill(rowSize, p); |
||||
|
||||
return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); |
||||
} |
||||
|
||||
public static JPanel createDataLayoutPane(String label, Component component) { |
||||
Component[][] components = new Component[][]{ |
||||
new Component[]{new UILabel(label, SwingConstants.LEFT), component} |
||||
}; |
||||
|
||||
return createDataLayoutPane(components); |
||||
} |
||||
|
||||
public static void addNormalBorder(JComponent component) { |
||||
component.setBorder(BorderFactory.createEmptyBorder(0, DataLayoutHelper.LEFT_GAP, 0, DataLayoutHelper.RIGHT_GAP)); |
||||
} |
||||
} |
@ -1,12 +1,19 @@
|
||||
package com.fr.van.chart.box.data.table; |
||||
|
||||
import com.fr.chart.chartdata.OneValueCDDefinition; |
||||
import com.fr.design.mainframe.chart.gui.ChartDataPane; |
||||
import com.fr.design.mainframe.chart.gui.data.table.SeriesNameUseFieldValuePane; |
||||
import com.fr.plugin.chart.box.data.VanBoxOneValueCDDefinition; |
||||
|
||||
import java.awt.Dimension; |
||||
|
||||
public class BoxPlotTableSeriesNameUseFieldValuePane extends SeriesNameUseFieldValuePane { |
||||
|
||||
protected OneValueCDDefinition createOneValueCDDefinition() { |
||||
return new VanBoxOneValueCDDefinition(); |
||||
} |
||||
|
||||
protected Dimension getLabelDimension() { |
||||
return new Dimension(ChartDataPane.LABEL_WIDTH, ChartDataPane.LABEL_HEIGHT); |
||||
} |
||||
} |
||||
|
@ -0,0 +1,36 @@
|
||||
package com.fr.van.chart.map.line; |
||||
|
||||
import com.fr.chart.chartattr.Plot; |
||||
import com.fr.design.gui.icheckbox.UICheckBox; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.plugin.chart.base.AttrTooltip; |
||||
import com.fr.van.chart.designer.style.VanChartStylePane; |
||||
|
||||
import java.awt.BorderLayout; |
||||
|
||||
/** |
||||
* @author Bjorn |
||||
* @version 10.0 |
||||
* Created by Bjorn on 2020-08-20 |
||||
*/ |
||||
public class VanChartLineMapPlotTooltipNoCheckPane extends VanChartLineMapPlotTooltipPane { |
||||
|
||||
public VanChartLineMapPlotTooltipNoCheckPane(Plot plot, VanChartStylePane parent) { |
||||
super(plot, parent); |
||||
} |
||||
|
||||
protected void addComponents(Plot plot) { |
||||
isTooltipShow = new UICheckBox(Toolkit.i18nText("Fine-Design_Chart_Use_Tooltip")); |
||||
tooltipPane = createTooltipPane(plot); |
||||
|
||||
this.setLayout(new BorderLayout()); |
||||
this.add(tooltipPane, BorderLayout.CENTER); |
||||
} |
||||
|
||||
@Override |
||||
public void populate(AttrTooltip attr) { |
||||
super.populate(attr); |
||||
isTooltipShow.setSelected(true); |
||||
tooltipPane.setEnabled(isTooltipShow.isSelected()); |
||||
} |
||||
} |
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 623 B |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 658 B |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue