白岳
4 years ago
57 changed files with 1950 additions and 639 deletions
@ -0,0 +1,48 @@
|
||||
package com.fr.design.actions.community; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.design.actions.UpdateAction; |
||||
import com.fr.design.locale.impl.BugNeedMark; |
||||
import com.fr.design.menu.MenuKeySet; |
||||
import com.fr.design.utils.BrowseUtils; |
||||
import com.fr.general.locale.LocaleCenter; |
||||
import com.fr.general.locale.LocaleMark; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.event.ActionEvent; |
||||
|
||||
/** |
||||
* @Author: Yuan.Wang |
||||
* @Date: 2020/7/28 |
||||
*/ |
||||
public class BugNeedAction extends UpdateAction { |
||||
public BugNeedAction() { |
||||
this.setMenuKeySet(BugAndNeed); |
||||
this.setName(getMenuKeySet().getMenuName()); |
||||
this.setMnemonic(getMenuKeySet().getMnemonic()); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/bbs/need.png")); |
||||
} |
||||
|
||||
@Override |
||||
public void actionPerformed(ActionEvent e) { |
||||
LocaleMark<String> localeMark = LocaleCenter.getMark(BugNeedMark.class); |
||||
BrowseUtils.browser(localeMark.getValue()); |
||||
} |
||||
|
||||
public static final MenuKeySet BugAndNeed = new MenuKeySet() { |
||||
@Override |
||||
public char getMnemonic() { |
||||
return 0; |
||||
} |
||||
|
||||
@Override |
||||
public String getMenuName() { |
||||
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Community_BugAndNeed"); |
||||
} |
||||
|
||||
@Override |
||||
public KeyStroke getKeyStroke() { |
||||
return null; |
||||
} |
||||
}; |
||||
} |
@ -0,0 +1,49 @@
|
||||
package com.fr.design.actions.community; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.design.actions.UpdateAction; |
||||
import com.fr.design.locale.impl.TechSupportMark; |
||||
import com.fr.design.menu.MenuKeySet; |
||||
import com.fr.design.utils.BrowseUtils; |
||||
import com.fr.general.locale.LocaleCenter; |
||||
import com.fr.general.locale.LocaleMark; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.event.ActionEvent; |
||||
|
||||
/** |
||||
* @Author: Yuan.Wang |
||||
* @Date: 2020/7/28 |
||||
*/ |
||||
public class TechSupportAction extends UpdateAction { |
||||
public TechSupportAction() { |
||||
this.setMenuKeySet(TechSupport); |
||||
this.setName(getMenuKeySet().getMenuName()); |
||||
this.setMnemonic(getMenuKeySet().getMnemonic()); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/bbs/support.png")); |
||||
} |
||||
|
||||
@Override |
||||
public void actionPerformed(ActionEvent e) { |
||||
LocaleMark<String> localeMark = LocaleCenter.getMark(TechSupportMark.class); |
||||
String str=localeMark.getValue(); |
||||
BrowseUtils.browser(localeMark.getValue()); |
||||
} |
||||
|
||||
public static final MenuKeySet TechSupport = new MenuKeySet() { |
||||
@Override |
||||
public char getMnemonic() { |
||||
return 0; |
||||
} |
||||
|
||||
@Override |
||||
public String getMenuName() { |
||||
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Community_TechSupport"); |
||||
} |
||||
|
||||
@Override |
||||
public KeyStroke getKeyStroke() { |
||||
return null; |
||||
} |
||||
}; |
||||
} |
@ -0,0 +1,9 @@
|
||||
package com.fr.design.event; |
||||
|
||||
/** |
||||
* @Author: Yuan.Wang |
||||
* @Date: 2020/7/29 |
||||
*/ |
||||
public interface StateChangeListener { |
||||
public void stateChange(); |
||||
} |
File diff suppressed because one or more lines are too long
@ -0,0 +1,29 @@
|
||||
package com.fr.design.locale.impl; |
||||
|
||||
import com.fr.general.CloudCenter; |
||||
import com.fr.general.GeneralContext; |
||||
import com.fr.general.locale.LocaleMark; |
||||
|
||||
import java.util.HashMap; |
||||
import java.util.Locale; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* @Author: Yuan.Wang |
||||
* @Date: 2020/7/29 |
||||
*/ |
||||
public class BugNeedMark implements LocaleMark<String> { |
||||
private Map<Locale, String> map = new HashMap<>(); |
||||
private static final String TW_BUG_AND_NEEDS = CloudCenter.getInstance().acquireUrlByKind("bbs.bug.needs.zh_TW"); |
||||
|
||||
public BugNeedMark() { |
||||
map.put(Locale.TAIWAN, TW_BUG_AND_NEEDS); |
||||
} |
||||
|
||||
@Override |
||||
public String getValue() { |
||||
String result = map.get(GeneralContext.getLocale()); |
||||
return result == null ? TW_BUG_AND_NEEDS : result; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,30 @@
|
||||
package com.fr.design.locale.impl; |
||||
|
||||
import com.fr.general.CloudCenter; |
||||
import com.fr.general.GeneralContext; |
||||
import com.fr.general.locale.LocaleMark; |
||||
|
||||
import java.util.HashMap; |
||||
import java.util.Locale; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* @Author: Yuan.Wang |
||||
* @Date: 2020/7/29 |
||||
*/ |
||||
public class TechSupportMark implements LocaleMark<String> { |
||||
private Map<Locale, String> map = new HashMap<>(); |
||||
private static final String EN_TECH_SUPPORT = CloudCenter.getInstance().acquireUrlByKind("bbs.tech.support.en_US"); |
||||
private static final String TW_TECH_SUPPORT = CloudCenter.getInstance().acquireUrlByKind("bbs.tech.support.zh_TW"); |
||||
|
||||
public TechSupportMark() { |
||||
map.put(Locale.US, EN_TECH_SUPPORT); |
||||
map.put(Locale.TAIWAN, TW_TECH_SUPPORT); |
||||
} |
||||
|
||||
@Override |
||||
public String getValue() { |
||||
String result = map.get(GeneralContext.getLocale()); |
||||
return result == null ? EN_TECH_SUPPORT : result; |
||||
} |
||||
} |
After Width: | Height: | Size: 385 B |
@ -0,0 +1,51 @@
|
||||
package com.fr.design.mainframe; |
||||
|
||||
import com.fr.invoke.Reflect; |
||||
import org.junit.Assert; |
||||
import org.junit.Test; |
||||
|
||||
/** |
||||
* Created by kerry on 2020-07-28 |
||||
*/ |
||||
public class JFormSliderPaneTest { |
||||
|
||||
@Test |
||||
public void testParseInputValue() { |
||||
JFormSliderPane sliderPane = new JFormSliderPane(); |
||||
int result = Reflect.on(sliderPane).call("parseInputValue", "100%").get(); |
||||
Assert.assertEquals(100, result); |
||||
result = Reflect.on(sliderPane).call("parseInputValue", "50%").get(); |
||||
Assert.assertEquals(50, result); |
||||
result = Reflect.on(sliderPane).call("parseInputValue", "50").get(); |
||||
Assert.assertEquals(50, result); |
||||
result = Reflect.on(sliderPane).call("parseInputValue", "50abc").get(); |
||||
Assert.assertEquals(100, result); |
||||
} |
||||
|
||||
@Test |
||||
public void testGetPreferredValue() { |
||||
JFormSliderPane sliderPane = new JFormSliderPane(); |
||||
int result = Reflect.on(sliderPane).call("getPreferredValue", 100).get(); |
||||
Assert.assertEquals(100, result); |
||||
result = Reflect.on(sliderPane).call("getPreferredValue", 0).get(); |
||||
Assert.assertEquals(10, result); |
||||
result = Reflect.on(sliderPane).call("getPreferredValue", 1000).get(); |
||||
Assert.assertEquals(400, result); |
||||
} |
||||
|
||||
@Test |
||||
public void testCalSliderValue() { |
||||
JFormSliderPane sliderPane = new JFormSliderPane(); |
||||
int result = Reflect.on(sliderPane).call("calSliderValue", 10).get(); |
||||
Assert.assertEquals(0, result); |
||||
result = Reflect.on(sliderPane).call("calSliderValue", 90).get(); |
||||
Assert.assertEquals(44, result); |
||||
result = Reflect.on(sliderPane).call("calSliderValue", 100).get(); |
||||
Assert.assertEquals(50, result); |
||||
result = Reflect.on(sliderPane).call("calSliderValue", 200).get(); |
||||
Assert.assertEquals(66, result); |
||||
result = Reflect.on(sliderPane).call("calSliderValue", 400).get(); |
||||
Assert.assertEquals(100, result); |
||||
|
||||
} |
||||
} |
@ -1,11 +0,0 @@
|
||||
package com.fr.van.chart.box.data; |
||||
|
||||
import com.fr.design.mainframe.chart.gui.ChartDataPane; |
||||
import com.fr.design.mainframe.chart.gui.data.report.CategoryPlotReportDataContentPane; |
||||
|
||||
public class BoxPlotReportDataContentPane extends CategoryPlotReportDataContentPane { |
||||
|
||||
public BoxPlotReportDataContentPane(ChartDataPane parent) { |
||||
super(parent); |
||||
} |
||||
} |
@ -1,4 +0,0 @@
|
||||
package com.fr.van.chart.box.data; |
||||
|
||||
public class BoxPlotReportResultDataSeriesPane { |
||||
} |
@ -0,0 +1,137 @@
|
||||
package com.fr.van.chart.box.data.report; |
||||
|
||||
import com.fr.chart.chartattr.ChartCollection; |
||||
import com.fr.chart.chartattr.Plot; |
||||
import com.fr.design.gui.ibutton.UIButtonGroup; |
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.design.mainframe.chart.gui.ChartDataPane; |
||||
import com.fr.design.mainframe.chart.gui.data.report.AbstractReportDataContentPane; |
||||
import com.fr.design.utils.gui.GUICoreUtils; |
||||
import com.fr.plugin.chart.box.VanChartBoxPlot; |
||||
import com.fr.plugin.chart.box.data.VanBoxReportDefinition; |
||||
|
||||
import javax.swing.BorderFactory; |
||||
import javax.swing.JPanel; |
||||
import java.awt.BorderLayout; |
||||
import java.awt.Component; |
||||
import java.awt.Dimension; |
||||
import java.awt.event.ActionEvent; |
||||
import java.awt.event.ActionListener; |
||||
|
||||
public class BoxPlotReportDataContentPane extends AbstractReportDataContentPane { |
||||
|
||||
private UIButtonGroup dataType; |
||||
|
||||
private BoxPlotReportDetailedDataSeriesPane detailedDataSeriesPane; |
||||
private BoxPlotReportResultDataSeriesPane resultDataSeriesPane; |
||||
|
||||
private Plot initplot; |
||||
|
||||
public BoxPlotReportDataContentPane(Plot plot, ChartDataPane parent) { |
||||
this.initplot = plot; |
||||
|
||||
this.setLayout(new BorderLayout()); |
||||
|
||||
this.add(createDataTypePane(), BorderLayout.NORTH); |
||||
this.add(createSeriesPane(parent), BorderLayout.CENTER); |
||||
|
||||
initDataTypeListener(); |
||||
} |
||||
|
||||
private JPanel createDataTypePane() { |
||||
JPanel pane = new JPanel(new BorderLayout(4, 0)); |
||||
pane.setBorder(BorderFactory.createMatteBorder(0, 0, 6, 1, getBackground())); |
||||
|
||||
UILabel label = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Data_Type")); |
||||
label.setPreferredSize(new Dimension(ChartDataPane.LABEL_WIDTH, ChartDataPane.LABEL_HEIGHT)); |
||||
|
||||
String[] names = new String[]{ |
||||
Toolkit.i18nText("Fine-Design_Chart_Detailed_Data"), |
||||
Toolkit.i18nText("Fine-Design_Chart_Result_Data") |
||||
}; |
||||
|
||||
dataType = new UIButtonGroup(names); |
||||
dataType.setPreferredSize(new Dimension(100, 20)); |
||||
|
||||
pane.add(GUICoreUtils.createBorderLayoutPane(new Component[]{dataType, null, null, label, null})); |
||||
pane.setPreferredSize(new Dimension(246, 30)); |
||||
pane.setBorder(BorderFactory.createEmptyBorder(0, 24, 10, 15)); |
||||
|
||||
return pane; |
||||
} |
||||
|
||||
private JPanel createSeriesPane(ChartDataPane parent) { |
||||
detailedDataSeriesPane = new BoxPlotReportDetailedDataSeriesPane(parent); |
||||
resultDataSeriesPane = new BoxPlotReportResultDataSeriesPane(); |
||||
|
||||
JPanel pane = new JPanel(new BorderLayout(4, 0)); |
||||
|
||||
pane.add(resultDataSeriesPane, BorderLayout.NORTH); |
||||
pane.add(detailedDataSeriesPane, BorderLayout.CENTER); |
||||
|
||||
return pane; |
||||
} |
||||
|
||||
private void initDataTypeListener() { |
||||
dataType.addActionListener(new ActionListener() { |
||||
|
||||
public void actionPerformed(ActionEvent e) { |
||||
checkDataPaneVisible(); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
private void checkDataPaneVisible() { |
||||
if (detailedDataSeriesPane != null) { |
||||
detailedDataSeriesPane.setVisible(dataType.getSelectedIndex() == 0); |
||||
} |
||||
if (resultDataSeriesPane != null) { |
||||
resultDataSeriesPane.setVisible(dataType.getSelectedIndex() == 1); |
||||
} |
||||
} |
||||
|
||||
public void updateBean(ChartCollection collection) { |
||||
collection.getSelectedChart().setFilterDefinition(new VanBoxReportDefinition()); |
||||
VanBoxReportDefinition report = BoxReportDefinitionHelper.getBoxReportDefinition(collection); |
||||
|
||||
if (report != null) { |
||||
boolean isDetailed = dataType.getSelectedIndex() == 0; |
||||
|
||||
report.setDetailed(isDetailed); |
||||
((VanChartBoxPlot) initplot).setDetailed(isDetailed); |
||||
} |
||||
if (detailedDataSeriesPane != null) { |
||||
detailedDataSeriesPane.updateBean(collection); |
||||
} |
||||
if (resultDataSeriesPane != null) { |
||||
resultDataSeriesPane.updateBean(collection); |
||||
} |
||||
} |
||||
|
||||
public void populateBean(ChartCollection collection) { |
||||
VanBoxReportDefinition report = BoxReportDefinitionHelper.getBoxReportDefinition(collection); |
||||
|
||||
if (report == null) { |
||||
dataType.setSelectedIndex(0); |
||||
checkDataPaneVisible(); |
||||
return; |
||||
} |
||||
|
||||
if (dataType != null) { |
||||
dataType.setSelectedIndex(BoxReportDefinitionHelper.isDetailedReportDataType(collection) ? 0 : 1); |
||||
} |
||||
if (detailedDataSeriesPane != null) { |
||||
detailedDataSeriesPane.populateBean(collection); |
||||
} |
||||
if (resultDataSeriesPane != null) { |
||||
resultDataSeriesPane.populateBean(collection); |
||||
} |
||||
|
||||
checkDataPaneVisible(); |
||||
} |
||||
|
||||
protected String[] columnNames() { |
||||
return new String[0]; |
||||
} |
||||
} |
@ -0,0 +1,38 @@
|
||||
package com.fr.van.chart.box.data.report; |
||||
|
||||
import com.fr.chart.chartattr.ChartCollection; |
||||
import com.fr.design.mainframe.chart.gui.ChartDataPane; |
||||
import com.fr.design.mainframe.chart.gui.data.report.CategoryPlotReportDataContentPane; |
||||
import com.fr.plugin.chart.box.data.VanBoxReportDefinition; |
||||
import com.fr.plugin.chart.box.data.VanBoxReportDetailedDefinition; |
||||
|
||||
public class BoxPlotReportDetailedDataSeriesPane extends CategoryPlotReportDataContentPane { |
||||
|
||||
public BoxPlotReportDetailedDataSeriesPane(ChartDataPane parent) { |
||||
super(parent); |
||||
} |
||||
|
||||
public void populateBean(ChartCollection ob) { |
||||
VanBoxReportDetailedDefinition definition = BoxReportDefinitionHelper.getBoxReportDetailedDefinition(ob); |
||||
|
||||
if (definition == null) { |
||||
return; |
||||
} |
||||
|
||||
this.populateDefinition(definition); |
||||
} |
||||
|
||||
public void updateBean(ChartCollection ob) { |
||||
VanBoxReportDefinition report = BoxReportDefinitionHelper.getBoxReportDefinition(ob); |
||||
|
||||
if (report == null) { |
||||
return; |
||||
} |
||||
|
||||
VanBoxReportDetailedDefinition detailedDefinition = new VanBoxReportDetailedDefinition(); |
||||
|
||||
this.updateDefinition(detailedDefinition); |
||||
|
||||
report.setDetailedDefinition(detailedDefinition); |
||||
} |
||||
} |
@ -0,0 +1,168 @@
|
||||
package com.fr.van.chart.box.data.report; |
||||
|
||||
import com.fr.chart.chartattr.ChartCollection; |
||||
import com.fr.design.formula.TinyFormulaPane; |
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.design.layout.TableLayout; |
||||
import com.fr.design.layout.TableLayoutHelper; |
||||
import com.fr.design.mainframe.chart.gui.data.report.AbstractReportDataContentPane; |
||||
import com.fr.plugin.chart.box.data.VanBoxReportDefinition; |
||||
import com.fr.plugin.chart.box.data.VanBoxReportResultDefinition; |
||||
|
||||
import javax.swing.BorderFactory; |
||||
import javax.swing.JPanel; |
||||
import java.awt.BorderLayout; |
||||
import java.awt.Component; |
||||
import java.awt.Dimension; |
||||
|
||||
public class BoxPlotReportResultDataSeriesPane extends AbstractReportDataContentPane { |
||||
|
||||
private TinyFormulaPane category; |
||||
private TinyFormulaPane seriesName; |
||||
|
||||
private TinyFormulaWithEditLabel max; |
||||
private TinyFormulaWithEditLabel q3; |
||||
private TinyFormulaWithEditLabel median; |
||||
private TinyFormulaWithEditLabel q1; |
||||
private TinyFormulaWithEditLabel min; |
||||
|
||||
public BoxPlotReportResultDataSeriesPane() { |
||||
this.setLayout(new BorderLayout()); |
||||
|
||||
initContentComponents(); |
||||
|
||||
JPanel panel = createContentPane(); |
||||
|
||||
panel.setBorder(BorderFactory.createEmptyBorder(0, 24, 0, 15)); |
||||
|
||||
this.add(panel, BorderLayout.CENTER); |
||||
} |
||||
|
||||
private void initContentComponents() { |
||||
|
||||
category = createTinyFormulaPaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Category")); |
||||
seriesName = createTinyFormulaPaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Series_Name")); |
||||
|
||||
max = createTinyFormulaWithEditLabel(Toolkit.i18nText("Fine-Design_Chart_Data_Max")); |
||||
q3 = createTinyFormulaWithEditLabel(Toolkit.i18nText("Fine-Design_Chart_Data_Q3")); |
||||
median = createTinyFormulaWithEditLabel(Toolkit.i18nText("Fine-Design_Chart_Data_Median")); |
||||
q1 = createTinyFormulaWithEditLabel(Toolkit.i18nText("Fine-Design_Chart_Data_Q1")); |
||||
min = createTinyFormulaWithEditLabel(Toolkit.i18nText("Fine-Design_Chart_Data_Min")); |
||||
} |
||||
|
||||
private JPanel createContentPane() { |
||||
double p = TableLayout.PREFERRED; |
||||
double f = TableLayout.FILL; |
||||
double[] row = {p, p, p, p, p, p, p}; |
||||
double[] col = {f}; |
||||
|
||||
Component[][] components = new Component[][]{ |
||||
new Component[]{category}, |
||||
new Component[]{seriesName}, |
||||
new Component[]{max}, |
||||
new Component[]{q3}, |
||||
new Component[]{median}, |
||||
new Component[]{q1}, |
||||
new Component[]{min} |
||||
}; |
||||
|
||||
return TableLayoutHelper.createTableLayoutPane(components, row, col); |
||||
} |
||||
|
||||
private TinyFormulaPane createTinyFormulaPaneWithTitle(final String title) { |
||||
|
||||
return new TinyFormulaPane() { |
||||
protected void initLayout() { |
||||
this.setLayout(new BorderLayout(4, 0)); |
||||
|
||||
UILabel label = new UILabel(title); |
||||
label.setPreferredSize(new Dimension(75, 20)); |
||||
this.add(label, BorderLayout.WEST); |
||||
|
||||
formulaTextField.setPreferredSize(new Dimension(100, 20)); |
||||
this.add(formulaTextField, BorderLayout.CENTER); |
||||
this.add(formulaTextFieldButton, BorderLayout.EAST); |
||||
} |
||||
}; |
||||
} |
||||
|
||||
private TinyFormulaWithEditLabel createTinyFormulaWithEditLabel(String title) { |
||||
|
||||
return new TinyFormulaWithEditLabel(title) { |
||||
protected void clearAllBackground() { |
||||
clearAllLabelBackground(); |
||||
} |
||||
}; |
||||
} |
||||
|
||||
private void clearAllLabelBackground() { |
||||
TinyFormulaWithEditLabel[] editLabels = new TinyFormulaWithEditLabel[]{max, q3, median, q1, min}; |
||||
|
||||
for (TinyFormulaWithEditLabel label : editLabels) { |
||||
if (label != null) { |
||||
label.clearBackGround(); |
||||
} |
||||
} |
||||
} |
||||
|
||||
public void populateBean(ChartCollection ob) { |
||||
VanBoxReportResultDefinition detailedDefinition = BoxReportDefinitionHelper.getBoxReportResultDefinition(ob); |
||||
|
||||
if (detailedDefinition == null) { |
||||
return; |
||||
} |
||||
|
||||
populateFormulaPane(category, detailedDefinition.getCategoryName()); |
||||
populateFormulaPane(seriesName, detailedDefinition.getSeriesName()); |
||||
|
||||
max.setHeaderName(detailedDefinition.getMaxLabel()); |
||||
q3.setHeaderName(detailedDefinition.getQ3Label()); |
||||
median.setHeaderName(detailedDefinition.getMedianLabel()); |
||||
q1.setHeaderName(detailedDefinition.getQ1Label()); |
||||
min.setHeaderName(detailedDefinition.getMinLabel()); |
||||
|
||||
max.populateFormula(detailedDefinition.getMax()); |
||||
q3.populateFormula(detailedDefinition.getQ3()); |
||||
median.populateFormula(detailedDefinition.getMedian()); |
||||
q1.populateFormula(detailedDefinition.getQ1()); |
||||
min.populateFormula(detailedDefinition.getMin()); |
||||
} |
||||
|
||||
private void populateFormulaPane(TinyFormulaPane pane, Object ob) { |
||||
if (ob != null) { |
||||
pane.populateBean(ob.toString()); |
||||
} |
||||
} |
||||
|
||||
public void updateBean(ChartCollection ob) { |
||||
VanBoxReportDefinition report = BoxReportDefinitionHelper.getBoxReportDefinition(ob); |
||||
|
||||
if (report == null) { |
||||
return; |
||||
} |
||||
|
||||
VanBoxReportResultDefinition resultDefinition = new VanBoxReportResultDefinition(); |
||||
|
||||
resultDefinition.setCategoryName(canBeFormula(category.getUITextField().getText())); |
||||
resultDefinition.setSeriesName(canBeFormula(seriesName.getUITextField().getText())); |
||||
|
||||
resultDefinition.setMaxLabel(max.getHeaderName()); |
||||
resultDefinition.setQ3Label(q3.getHeaderName()); |
||||
resultDefinition.setMedianLabel(median.getHeaderName()); |
||||
resultDefinition.setQ1Label(q1.getHeaderName()); |
||||
resultDefinition.setMinLabel(min.getHeaderName()); |
||||
|
||||
resultDefinition.setMax(canBeFormula(max.updateFormula())); |
||||
resultDefinition.setQ3(canBeFormula(q3.updateFormula())); |
||||
resultDefinition.setMedian(canBeFormula(median.updateFormula())); |
||||
resultDefinition.setQ1(canBeFormula(q1.updateFormula())); |
||||
resultDefinition.setMin(canBeFormula(min.updateFormula())); |
||||
|
||||
report.setResultDefinition(resultDefinition); |
||||
} |
||||
|
||||
protected String[] columnNames() { |
||||
return new String[0]; |
||||
} |
||||
} |
@ -0,0 +1,58 @@
|
||||
package com.fr.van.chart.box.data.report; |
||||
|
||||
import com.fr.base.chart.chartdata.TopDefinitionProvider; |
||||
import com.fr.chart.chartattr.Chart; |
||||
import com.fr.chart.chartattr.ChartCollection; |
||||
import com.fr.plugin.chart.box.data.VanBoxReportDefinition; |
||||
import com.fr.plugin.chart.box.data.VanBoxReportDetailedDefinition; |
||||
import com.fr.plugin.chart.box.data.VanBoxReportResultDefinition; |
||||
|
||||
public class BoxReportDefinitionHelper { |
||||
|
||||
public static VanBoxReportDefinition getBoxReportDefinition(ChartCollection collection) { |
||||
if (collection != null) { |
||||
|
||||
Chart chart = collection.getSelectedChart(); |
||||
|
||||
if (chart != null) { |
||||
TopDefinitionProvider definitionProvider = chart.getFilterDefinition(); |
||||
|
||||
if (definitionProvider instanceof VanBoxReportDefinition) { |
||||
return (VanBoxReportDefinition) definitionProvider; |
||||
} |
||||
} |
||||
} |
||||
|
||||
return null; |
||||
} |
||||
|
||||
public static VanBoxReportResultDefinition getBoxReportResultDefinition(ChartCollection collection) { |
||||
VanBoxReportDefinition report = getBoxReportDefinition(collection); |
||||
|
||||
if (report != null) { |
||||
return report.getResultDefinition(); |
||||
} |
||||
|
||||
return null; |
||||
} |
||||
|
||||
public static VanBoxReportDetailedDefinition getBoxReportDetailedDefinition(ChartCollection collection) { |
||||
VanBoxReportDefinition report = getBoxReportDefinition(collection); |
||||
|
||||
if (report != null) { |
||||
return report.getDetailedDefinition(); |
||||
} |
||||
|
||||
return null; |
||||
} |
||||
|
||||
public static boolean isDetailedReportDataType(ChartCollection collection) { |
||||
VanBoxReportDefinition report = getBoxReportDefinition(collection); |
||||
|
||||
if (report != null) { |
||||
return report.isDetailed(); |
||||
} |
||||
|
||||
return true; |
||||
} |
||||
} |
@ -0,0 +1,71 @@
|
||||
package com.fr.van.chart.box.data.report; |
||||
|
||||
import com.fr.design.event.UIObserver; |
||||
import com.fr.design.event.UIObserverListener; |
||||
import com.fr.design.formula.TinyFormulaPane; |
||||
import com.fr.design.mainframe.chart.gui.UIEditLabel; |
||||
|
||||
import javax.swing.JPanel; |
||||
import javax.swing.SwingConstants; |
||||
import java.awt.BorderLayout; |
||||
import java.awt.Dimension; |
||||
|
||||
public abstract class TinyFormulaWithEditLabel extends JPanel implements UIObserver { |
||||
|
||||
private UIEditLabel editLabel; |
||||
private TinyFormulaPane tinyFormulaPane; |
||||
|
||||
protected UIObserverListener listener; |
||||
|
||||
public TinyFormulaWithEditLabel(String text) { |
||||
editLabel = new UIEditLabel(text, SwingConstants.LEFT) { |
||||
protected void doAfterMousePress() { |
||||
clearAllBackground(); |
||||
} |
||||
|
||||
protected boolean appendOriginalLabel() { |
||||
return false; |
||||
} |
||||
}; |
||||
|
||||
editLabel.setPreferredSize(new Dimension(75, 20)); |
||||
tinyFormulaPane = new TinyFormulaPane(); |
||||
|
||||
this.setLayout(new BorderLayout(4, 0)); |
||||
this.add(editLabel, BorderLayout.WEST); |
||||
this.add(tinyFormulaPane, BorderLayout.CENTER); |
||||
} |
||||
|
||||
protected abstract void clearAllBackground(); |
||||
|
||||
public void clearBackGround() { |
||||
editLabel.resetNomalrBackground(); |
||||
} |
||||
|
||||
public boolean shouldResponseChangeListener() { |
||||
return true; |
||||
} |
||||
|
||||
public void registerChangeListener(UIObserverListener listener) { |
||||
this.listener = listener; |
||||
editLabel.registerChangeListener(listener); |
||||
} |
||||
|
||||
public void populateFormula(Object ob) { |
||||
if (ob != null) { |
||||
tinyFormulaPane.populateBean(ob.toString()); |
||||
} |
||||
} |
||||
|
||||
public Object updateFormula() { |
||||
return tinyFormulaPane.getUITextField().getText(); |
||||
} |
||||
|
||||
public String getHeaderName() { |
||||
return editLabel.getText(); |
||||
} |
||||
|
||||
public void setHeaderName(String text) { |
||||
editLabel.setText(text); |
||||
} |
||||
} |
@ -0,0 +1,86 @@
|
||||
package com.fr.van.chart.box.data.table; |
||||
|
||||
import com.fr.design.event.UIObserver; |
||||
import com.fr.design.event.UIObserverListener; |
||||
import com.fr.design.gui.icombobox.UIComboBox; |
||||
import com.fr.design.mainframe.chart.gui.UIEditLabel; |
||||
|
||||
import javax.swing.JPanel; |
||||
import javax.swing.SwingConstants; |
||||
import java.awt.BorderLayout; |
||||
import java.awt.Dimension; |
||||
import java.awt.event.ItemListener; |
||||
|
||||
public abstract class UIComboBoxWithEditLabel extends JPanel implements UIObserver { |
||||
|
||||
private UIEditLabel editLabel; |
||||
private UIComboBox comboBox; |
||||
|
||||
protected UIObserverListener listener; |
||||
|
||||
public UIComboBoxWithEditLabel(String text) { |
||||
editLabel = new UIEditLabel(text, SwingConstants.LEFT) { |
||||
protected void doAfterMousePress() { |
||||
clearAllBackground(); |
||||
} |
||||
|
||||
protected boolean appendOriginalLabel() { |
||||
return false; |
||||
} |
||||
}; |
||||
|
||||
editLabel.setPreferredSize(new Dimension(75, 20)); |
||||
comboBox = new UIComboBox(); |
||||
|
||||
this.setLayout(new BorderLayout(4, 0)); |
||||
this.add(editLabel, BorderLayout.WEST); |
||||
this.add(comboBox, BorderLayout.CENTER); |
||||
} |
||||
|
||||
public UIComboBox getComboBox() { |
||||
return comboBox; |
||||
} |
||||
|
||||
public void setComboBox(UIComboBox comboBox) { |
||||
this.comboBox = comboBox; |
||||
} |
||||
|
||||
protected void addItemListener(ItemListener aListener) { |
||||
comboBox.addItemListener(aListener); |
||||
} |
||||
|
||||
protected abstract void clearAllBackground(); |
||||
|
||||
public void clearBackGround() { |
||||
editLabel.resetNomalrBackground(); |
||||
} |
||||
|
||||
public boolean shouldResponseChangeListener() { |
||||
return true; |
||||
} |
||||
|
||||
public void registerChangeListener(UIObserverListener listener) { |
||||
this.listener = listener; |
||||
editLabel.registerChangeListener(listener); |
||||
} |
||||
|
||||
public void populateComboBox(String value) { |
||||
if (comboBox != null) { |
||||
comboBox.setEditable(true); |
||||
comboBox.setSelectedItem(value); |
||||
comboBox.setEditable(false); |
||||
} |
||||
} |
||||
|
||||
public Object updateComboBox() { |
||||
return comboBox.getSelectedItem(); |
||||
} |
||||
|
||||
public String getHeaderName() { |
||||
return editLabel.getText(); |
||||
} |
||||
|
||||
public void setHeaderName(String text) { |
||||
editLabel.setText(text); |
||||
} |
||||
} |
Loading…
Reference in new issue