forked from fanruan/design
Yuan.Wang
4 years ago
107 changed files with 2869 additions and 916 deletions
@ -0,0 +1,23 @@
|
||||
package com.fr.design.cell; |
||||
|
||||
import com.fr.design.designer.TargetComponent; |
||||
import com.fr.design.dialog.BasicPane; |
||||
|
||||
import javax.swing.JPanel; |
||||
|
||||
/** |
||||
* @author zack |
||||
* @version 10.0 |
||||
* Created by zack on 2020/7/14 |
||||
*/ |
||||
public abstract class AbstractCellElementPropertyPane extends BasicPane implements CellElementPropertyComponent { |
||||
@Override |
||||
public JPanel toPanel() { |
||||
return this; |
||||
} |
||||
|
||||
@Override |
||||
public boolean accept(TargetComponent tc) { |
||||
return true; |
||||
} |
||||
} |
@ -0,0 +1,34 @@
|
||||
package com.fr.design.cell; |
||||
|
||||
import com.fr.design.designer.TargetComponent; |
||||
|
||||
import javax.swing.JPanel; |
||||
|
||||
/** |
||||
* 单元格属性配置面板接口 |
||||
* @author zack |
||||
* @version 10.0 |
||||
* Created by zack on 2020/7/14 |
||||
*/ |
||||
public interface CellElementPropertyComponent { |
||||
|
||||
/** |
||||
* 判断当前编辑的对象是否显示当前实现 |
||||
* @param tc |
||||
* @return |
||||
*/ |
||||
boolean accept(TargetComponent tc); |
||||
|
||||
/** |
||||
* 加载数据 |
||||
* @param tc |
||||
*/ |
||||
void populate(TargetComponent tc); |
||||
|
||||
/** |
||||
* 返回当前属性面板,默认返回this |
||||
* @return |
||||
*/ |
||||
JPanel toPanel(); |
||||
|
||||
} |
@ -0,0 +1,18 @@
|
||||
package com.fr.design.fun; |
||||
|
||||
import com.fr.design.cell.CellElementPropertyComponent; |
||||
|
||||
/** |
||||
* 单元格设置(属性)扩展接口 |
||||
* @author zack |
||||
* @version 10.0 |
||||
* Created by zack on 2020/7/14 |
||||
*/ |
||||
public interface CellPropertyPaneProvider extends PropertyItemPaneProvider { |
||||
|
||||
/** |
||||
* 构造单元格属性面板,面板实现需要使用单例模式实现 |
||||
* @return 面板类 |
||||
*/ |
||||
CellElementPropertyComponent getSingletonCelPropertyPane(); |
||||
} |
@ -0,0 +1,15 @@
|
||||
package com.fr.design.fun.impl; |
||||
|
||||
import com.fr.design.fun.CellPropertyPaneProvider; |
||||
import com.fr.stable.fun.mark.API; |
||||
|
||||
/** |
||||
* Created by zhouping on 2015/11/11. |
||||
*/ |
||||
@API(level = CellPropertyPaneProvider.CURRENT_LEVEL) |
||||
public abstract class AbstractCellPropertyPaneProvider extends AbstractPropertyItemPaneProvider implements CellPropertyPaneProvider { |
||||
|
||||
public int currentAPILevel() { |
||||
return CellPropertyPaneProvider.CURRENT_LEVEL; |
||||
} |
||||
} |
@ -0,0 +1,39 @@
|
||||
package com.fr.design.os.impl; |
||||
|
||||
import com.fr.design.gui.controlpane.UIListControlPane; |
||||
import com.fr.stable.os.OperatingSystem; |
||||
import com.fr.stable.os.support.OSBasedAction; |
||||
|
||||
import java.awt.*; |
||||
|
||||
/** |
||||
* linux下超链弹窗等保存问题 |
||||
* |
||||
* @author hades |
||||
* @version 10.0 |
||||
* Created by hades on 2020/7/21 |
||||
*/ |
||||
public class PopupDialogSaveAction implements OSBasedAction { |
||||
|
||||
private UIListControlPane currentControlPane; |
||||
private Window popupDialog; |
||||
|
||||
@Override |
||||
public void execute(Object... objects) { |
||||
boolean canSave = OperatingSystem.isLinux() && popupDialog != null && popupDialog.isVisible() && currentControlPane != null; |
||||
if (canSave) { |
||||
currentControlPane.saveSettings(); |
||||
} |
||||
} |
||||
|
||||
public void register(UIListControlPane currentControlPane, Window popupDialog) { |
||||
this.currentControlPane = currentControlPane; |
||||
this.popupDialog = popupDialog; |
||||
} |
||||
|
||||
public void unregister() { |
||||
this.currentControlPane = null; |
||||
this.popupDialog = null; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,25 @@
|
||||
package com.fr.design.env; |
||||
|
||||
import com.fr.workspace.connect.WorkspaceConnectionInfo; |
||||
import junit.framework.TestCase; |
||||
import org.junit.Assert; |
||||
|
||||
/** |
||||
* @author hades |
||||
* @version 10.0 |
||||
* Created by hades on 2020/7/15 |
||||
*/ |
||||
public class RemoteDesignerWorkspaceInfoTest extends TestCase { |
||||
|
||||
public void testCheckValid() { |
||||
RemoteDesignerWorkspaceInfo workspaceInfo0 = RemoteDesignerWorkspaceInfo.create(new WorkspaceConnectionInfo("http://localhost:8075/webroot/decision", "admin", "123", "", "", true)); |
||||
RemoteDesignerWorkspaceInfo workspaceInfo1 = RemoteDesignerWorkspaceInfo.create(new WorkspaceConnectionInfo("http://127.0.0.1:8075/webroot/decision", "admin", "123", "", "", true)); |
||||
RemoteDesignerWorkspaceInfo workspaceInfo2 = RemoteDesignerWorkspaceInfo.create(new WorkspaceConnectionInfo("https://127.0.0.1:8075/webroot/decision", "admin", "123", "", "", true)); |
||||
RemoteDesignerWorkspaceInfo workspaceInfo3 = RemoteDesignerWorkspaceInfo.create(new WorkspaceConnectionInfo("https://localhost:8075/webroot/decision", "admin", "123", "", "", true)); |
||||
Assert.assertFalse(workspaceInfo0.checkValid()); |
||||
Assert.assertFalse(workspaceInfo1.checkValid()); |
||||
Assert.assertFalse(workspaceInfo2.checkValid()); |
||||
Assert.assertFalse(workspaceInfo3.checkValid()); |
||||
} |
||||
|
||||
} |
@ -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); |
||||
|
||||
} |
||||
} |
@ -0,0 +1,142 @@
|
||||
package com.fr.design.module; |
||||
|
||||
import com.fr.base.ChartColorMatching; |
||||
import com.fr.base.ChartPreStyleConfig; |
||||
import com.fr.base.Utils; |
||||
import com.fr.design.beans.BasicBeanPane; |
||||
import com.fr.design.gui.controlpane.JListControlPane; |
||||
import com.fr.design.gui.controlpane.NameObjectCreator; |
||||
import com.fr.design.gui.controlpane.NameableCreator; |
||||
import com.fr.design.gui.controlpane.ShortCut4JControlPane; |
||||
import com.fr.design.gui.ilist.ModNameActionListener; |
||||
import com.fr.design.menu.ShortCut; |
||||
import com.fr.general.NameObject; |
||||
import com.fr.stable.Nameable; |
||||
|
||||
import javax.swing.event.ListSelectionEvent; |
||||
import javax.swing.event.ListSelectionListener; |
||||
import java.util.ArrayList; |
||||
import java.util.Iterator; |
||||
|
||||
/** |
||||
* @author Bjorn |
||||
* @version 10.0 |
||||
* Created by Bjorn on 2020-07-08 |
||||
*/ |
||||
public class ChartPreStyleListPane extends JListControlPane { |
||||
|
||||
ChartPreStyleManagerPane chartPreStyleManagerPane; |
||||
|
||||
public ChartPreStyleListPane(ChartPreStyleManagerPane chartPreStyleManagerPane) { |
||||
super(); |
||||
this.chartPreStyleManagerPane = chartPreStyleManagerPane; |
||||
initListener(); |
||||
} |
||||
|
||||
/** |
||||
* 创建有名字的creator |
||||
* |
||||
* @return 有名字的creator数组 |
||||
*/ |
||||
@Override |
||||
public NameableCreator[] createNameableCreators() { |
||||
return new NameableCreator[]{ |
||||
new NameObjectCreator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_PreStyle_Duplicate"), |
||||
ChartColorMatching.class, ChartPreStylePane.class) |
||||
}; |
||||
} |
||||
|
||||
@Override |
||||
protected String title4PopupWindow() { |
||||
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_PreStyle"); |
||||
} |
||||
|
||||
@Override |
||||
public BasicBeanPane createPaneByCreators(NameableCreator creator) { |
||||
return new ChartPreStylePane() { |
||||
@Override |
||||
protected void refreshWhenStyleChange(ChartColorMatching preStyle) { |
||||
super.refreshWhenStyleChange(preStyle); |
||||
chartPreStyleManagerPane.refreshDefaultColorBox(); |
||||
} |
||||
}; |
||||
} |
||||
|
||||
|
||||
protected ShortCut4JControlPane[] createShortcuts() { |
||||
return new ShortCut4JControlPane[]{ |
||||
shortCutFactory.addItemShortCut(), |
||||
createRemoveItemShortCut(), |
||||
shortCutFactory.copyItemShortCut(), |
||||
shortCutFactory.moveUpItemShortCut(), |
||||
shortCutFactory.moveDownItemShortCut(), |
||||
shortCutFactory.sortItemShortCut() |
||||
}; |
||||
} |
||||
|
||||
private ShortCut4JControlPane createRemoveItemShortCut() { |
||||
ShortCut4JControlPane shortCut4JControlPane = shortCutFactory.removeItemShortCut(); |
||||
//替换删除按钮的check事件。
|
||||
ShortCut shortCut = shortCut4JControlPane.getShortCut(); |
||||
shortCut4JControlPane = new MoreThanOneShortCut(shortCut); |
||||
return shortCut4JControlPane; |
||||
} |
||||
|
||||
public void initListener() { |
||||
nameableList.addListSelectionListener(new ListSelectionListener() { |
||||
@Override |
||||
public void valueChanged(ListSelectionEvent e) { |
||||
chartPreStyleManagerPane.refreshDefaultColorBox(); |
||||
} |
||||
}); |
||||
nameableList.addModNameActionListener(new ModNameActionListener() { |
||||
@Override |
||||
public void nameModed(int index, String oldName, String newName) { |
||||
chartPreStyleManagerPane.refreshDefaultColorBox(oldName, newName); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
public void populateBean() { |
||||
ChartPreStyleConfig config = ChartPreStyleConfig.getInstance().mirror(); |
||||
ArrayList list = new ArrayList(); |
||||
|
||||
Iterator keys = config.names(); |
||||
while (keys.hasNext()) { |
||||
Object key = keys.next(); |
||||
ChartColorMatching value = (ChartColorMatching) config.getPreStyle(key); |
||||
|
||||
list.add(new NameObject(Utils.objectToString(key), value)); |
||||
} |
||||
|
||||
Nameable[] values = (Nameable[]) list.toArray(new Nameable[list.size()]); |
||||
populate(values); |
||||
|
||||
if (config.containsName(config.getCurrentStyle())) { |
||||
this.setSelectedName(config.getCurrentStyle()); |
||||
} |
||||
} |
||||
|
||||
public void updateBean() { |
||||
ChartPreStyleConfig config = ChartPreStyleConfig.getInstance(); |
||||
|
||||
Nameable[] values = update(); |
||||
config.clearAllPreStyle(); |
||||
|
||||
for (Nameable value : values) { |
||||
config.putPreStyle(value.getName(), ((NameObject) value).getObject()); |
||||
} |
||||
} |
||||
|
||||
private class MoreThanOneShortCut extends ShortCut4JControlPane { |
||||
public MoreThanOneShortCut(ShortCut shortCut) { |
||||
this.shortCut = shortCut; |
||||
} |
||||
|
||||
|
||||
@Override |
||||
public void checkEnable() { |
||||
this.shortCut.setEnabled(nameableList.getModel().getSize() > 1); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,97 @@
|
||||
package com.fr.van.chart.box; |
||||
|
||||
import com.fr.chart.chartattr.Chart; |
||||
import com.fr.chart.chartattr.Plot; |
||||
import com.fr.design.beans.BasicBeanPane; |
||||
import com.fr.design.condition.ConditionAttributesPane; |
||||
import com.fr.design.gui.frpane.AttributeChangeListener; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.design.layout.TableLayout; |
||||
import com.fr.design.mainframe.chart.AbstractChartAttrPane; |
||||
import com.fr.design.mainframe.chart.gui.ChartDataPane; |
||||
import com.fr.design.mainframe.chart.gui.ChartStylePane; |
||||
import com.fr.design.mainframe.chart.gui.data.report.AbstractReportDataContentPane; |
||||
import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane; |
||||
import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; |
||||
import com.fr.van.chart.box.data.BoxPlotReportDataContentPane; |
||||
import com.fr.van.chart.box.data.table.BoxPlotTableDataContentPane; |
||||
import com.fr.van.chart.designer.other.VanChartInteractivePane; |
||||
import com.fr.van.chart.designer.other.VanChartOtherPane; |
||||
import com.fr.van.chart.designer.other.zoom.ZoomPane; |
||||
import com.fr.van.chart.designer.style.VanChartStylePane; |
||||
import com.fr.van.chart.vanchart.AbstractIndependentVanChartUI; |
||||
|
||||
import java.awt.Component; |
||||
|
||||
public class BoxIndependentVanChartInterface extends AbstractIndependentVanChartUI { |
||||
|
||||
public String getName() { |
||||
return Toolkit.i18nText("Fine-Design_Chart_New_Box"); |
||||
} |
||||
|
||||
public String[] getSubName() { |
||||
return new String[]{ |
||||
Toolkit.i18nText("Fine-Design_Chart_New_Box") |
||||
}; |
||||
} |
||||
|
||||
public String[] getDemoImagePath() { |
||||
return new String[]{ |
||||
"com/fr/plugin/chart/demo/image/box.png" |
||||
}; |
||||
} |
||||
|
||||
public String getIconPath() { |
||||
return "com/fr/design/images/form/toolbar/box.png"; |
||||
} |
||||
|
||||
public AbstractTableDataContentPane getTableDataSourcePane(Plot plot, ChartDataPane parent) { |
||||
return new BoxPlotTableDataContentPane(plot, parent); |
||||
} |
||||
|
||||
public AbstractReportDataContentPane getReportDataSourcePane(Plot plot, ChartDataPane parent) { |
||||
return new BoxPlotReportDataContentPane(parent); |
||||
} |
||||
|
||||
public AbstractChartTypePane getPlotTypePane() { |
||||
return new VanChartBoxPlotPane(); |
||||
} |
||||
|
||||
public ConditionAttributesPane getPlotConditionPane(Plot plot) { |
||||
return new VanChartBoxConditionPane(plot); |
||||
} |
||||
|
||||
public BasicBeanPane<Plot> getPlotSeriesPane(ChartStylePane parent, Plot plot) { |
||||
return new VanChartBoxSeriesPane(parent, plot); |
||||
} |
||||
|
||||
public AbstractChartAttrPane[] getAttrPaneArray(AttributeChangeListener listener) { |
||||
VanChartStylePane stylePane = new VanChartBoxStylePane(listener); |
||||
VanChartOtherPane otherPane = new VanChartOtherPane() { |
||||
|
||||
protected BasicBeanPane<Chart> createInteractivePane() { |
||||
return new VanChartInteractivePane() { |
||||
|
||||
protected Component[][] createToolBarComponents() { |
||||
return new Component[][]{ |
||||
new Component[]{null, exportImages}, |
||||
new Component[]{null, fullScreenDisplay} |
||||
}; |
||||
} |
||||
|
||||
protected double[] getToolBarRowSize() { |
||||
double p = TableLayout.PREFERRED; |
||||
return new double[]{p, p}; |
||||
} |
||||
|
||||
protected ZoomPane createZoomPane() { |
||||
return new ZoomPane(); |
||||
} |
||||
}; |
||||
} |
||||
}; |
||||
|
||||
return new AbstractChartAttrPane[]{stylePane, otherPane}; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,53 @@
|
||||
package com.fr.van.chart.box; |
||||
|
||||
import com.fr.chart.base.AttrAlpha; |
||||
import com.fr.chart.base.AttrBackground; |
||||
import com.fr.chart.base.AttrBorder; |
||||
import com.fr.chart.chartattr.Plot; |
||||
import com.fr.design.chart.series.SeriesCondition.ChartConditionPane; |
||||
import com.fr.design.chart.series.SeriesCondition.DataSeriesConditionPane; |
||||
import com.fr.design.chart.series.SeriesCondition.LabelAlphaPane; |
||||
import com.fr.plugin.chart.box.VanChartBoxPlot; |
||||
import com.fr.plugin.chart.type.ConditionKeyType; |
||||
import com.fr.van.chart.column.VanChartColumnLabelBorderPane; |
||||
import com.fr.van.chart.designer.other.condition.item.VanChartColumnSeriesColorConditionPane; |
||||
|
||||
import java.awt.Dimension; |
||||
|
||||
public class VanChartBoxConditionPane extends DataSeriesConditionPane { |
||||
|
||||
public VanChartBoxConditionPane(Plot plot) { |
||||
super(plot); |
||||
} |
||||
|
||||
protected void initComponents() { |
||||
super.initComponents(); |
||||
|
||||
liteConditionPane.setPreferredSize(new Dimension(300, 400)); |
||||
} |
||||
|
||||
protected void addBasicAction() { |
||||
classPaneMap.put(AttrBackground.class, new VanChartColumnSeriesColorConditionPane(this)); |
||||
classPaneMap.put(AttrAlpha.class, new LabelAlphaPane(this)); |
||||
classPaneMap.put(AttrBorder.class, new VanChartColumnLabelBorderPane(this)); |
||||
} |
||||
|
||||
protected void addStyleAction() { |
||||
} |
||||
|
||||
protected ChartConditionPane createListConditionPane() { |
||||
|
||||
return new ChartConditionPane() { |
||||
|
||||
@Override |
||||
protected ConditionKeyType[] conditionKeyTypes() { |
||||
return ConditionKeyType.BOX_CONDITION_KEY_TYPES; |
||||
} |
||||
}; |
||||
} |
||||
|
||||
|
||||
public Class<? extends Plot> class4Correspond() { |
||||
return VanChartBoxPlot.class; |
||||
} |
||||
} |
@ -0,0 +1,45 @@
|
||||
package com.fr.van.chart.box; |
||||
|
||||
import com.fr.chart.chartattr.Chart; |
||||
import com.fr.chart.chartattr.Plot; |
||||
import com.fr.log.FineLoggerFactory; |
||||
import com.fr.plugin.chart.box.BoxIndependentVanChart; |
||||
import com.fr.plugin.chart.box.VanChartBoxPlot; |
||||
import com.fr.van.chart.designer.type.AbstractVanChartTypePane; |
||||
|
||||
public class VanChartBoxPlotPane extends AbstractVanChartTypePane { |
||||
|
||||
protected String[] getTypeIconPath() { |
||||
return new String[]{"/com/fr/van/chart/box.images/box.png" |
||||
}; |
||||
} |
||||
|
||||
protected Plot getSelectedClonedPlot() { |
||||
VanChartBoxPlot newPlot = null; |
||||
|
||||
Chart[] boxChartGroup = BoxIndependentVanChart.BoxVanChartTypes; |
||||
|
||||
for (int i = 0, len = boxChartGroup.length; i < len; i++) { |
||||
if (typeDemo.get(i).isPressing) { |
||||
newPlot = boxChartGroup[i].getPlot(); |
||||
} |
||||
} |
||||
|
||||
Plot cloned = null; |
||||
|
||||
try { |
||||
if (newPlot != null) { |
||||
cloned = (Plot) newPlot.clone(); |
||||
} |
||||
} catch (CloneNotSupportedException e) { |
||||
FineLoggerFactory.getLogger().error("Error In ColumnChart"); |
||||
} |
||||
|
||||
return cloned; |
||||
} |
||||
|
||||
public Chart getDefaultChart() { |
||||
return BoxIndependentVanChart.BoxVanChartTypes[0]; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,26 @@
|
||||
package com.fr.van.chart.box; |
||||
|
||||
import com.fr.chart.chartattr.Plot; |
||||
import com.fr.plugin.chart.base.AttrTooltip; |
||||
import com.fr.plugin.chart.box.attr.AttrBoxTooltip; |
||||
import com.fr.van.chart.designer.style.VanChartStylePane; |
||||
import com.fr.van.chart.designer.style.tooltip.VanChartPlotTooltipPane; |
||||
|
||||
public class VanChartBoxPlotTooltipPane extends VanChartPlotTooltipPane { |
||||
|
||||
public VanChartBoxPlotTooltipPane(Plot plot, VanChartStylePane parent) { |
||||
super(plot, parent); |
||||
} |
||||
|
||||
protected void initTooltipContentPane(Plot plot) { |
||||
tooltipContentPane = new VanChartBoxTooltipContentPane(parent, VanChartBoxPlotTooltipPane.this); |
||||
} |
||||
|
||||
protected AttrTooltip getAttrTooltip() { |
||||
return new AttrBoxTooltip(); |
||||
} |
||||
|
||||
protected boolean hasTooltipSeriesType() { |
||||
return false; |
||||
} |
||||
} |
@ -0,0 +1,107 @@
|
||||
package com.fr.van.chart.box; |
||||
|
||||
import com.fr.chart.chartattr.Plot; |
||||
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.ChartStylePane; |
||||
import com.fr.plugin.chart.box.VanChartBoxPlot; |
||||
import com.fr.van.chart.designer.TableLayout4VanChartHelper; |
||||
import com.fr.van.chart.designer.component.VanChartBeautyPane; |
||||
import com.fr.van.chart.designer.component.VanChartMarkerPane; |
||||
import com.fr.van.chart.designer.component.border.VanChartBorderPane; |
||||
import com.fr.van.chart.designer.style.series.VanChartAbstractPlotSeriesPane; |
||||
|
||||
import javax.swing.JPanel; |
||||
import java.awt.BorderLayout; |
||||
import java.awt.Component; |
||||
|
||||
public class VanChartBoxSeriesPane extends VanChartAbstractPlotSeriesPane { |
||||
|
||||
private JPanel normalMarker; |
||||
private JPanel outlierMarker; |
||||
|
||||
private VanChartMarkerPane normalValuePane; |
||||
private VanChartMarkerPane outlierValuePane; |
||||
|
||||
public VanChartBoxSeriesPane(ChartStylePane parent, Plot plot) { |
||||
super(parent, plot); |
||||
} |
||||
|
||||
protected JPanel getContentInPlotType() { |
||||
double p = TableLayout.PREFERRED; |
||||
double f = TableLayout.FILL; |
||||
|
||||
double[] columnSize = {f}; |
||||
double[] rowSize = {p, p, p}; |
||||
|
||||
Component[][] components = new Component[][]{ |
||||
new Component[]{createBorderPane()}, |
||||
new Component[]{createNormalValuePane()}, |
||||
new Component[]{createOutlierValuePane()} |
||||
}; |
||||
|
||||
contentPane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); |
||||
|
||||
return contentPane; |
||||
} |
||||
|
||||
protected VanChartBorderPane createDiffBorderPane() { |
||||
return new VanChartBorderPane(); |
||||
} |
||||
|
||||
private JPanel createNormalValuePane() { |
||||
normalValuePane = new VanChartMarkerPane(); |
||||
normalMarker = TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Engine_Chart_Normal_Value"), normalValuePane); |
||||
|
||||
return normalMarker; |
||||
} |
||||
|
||||
private JPanel createOutlierValuePane() { |
||||
outlierValuePane = new VanChartMarkerPane(); |
||||
outlierMarker = TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Engine_Chart_Outlier_Value"), outlierValuePane); |
||||
|
||||
return outlierMarker; |
||||
} |
||||
|
||||
private void checkMarkerPane(boolean isDetailed) { |
||||
normalMarker.setVisible(isDetailed); |
||||
outlierMarker.setVisible(isDetailed); |
||||
} |
||||
|
||||
protected void setColorPaneContent(JPanel panel) { |
||||
panel.add(createAlphaPane(), BorderLayout.SOUTH); |
||||
} |
||||
|
||||
protected VanChartBeautyPane createStylePane() { |
||||
return null; |
||||
} |
||||
|
||||
public void populateBean(Plot plot) { |
||||
if (plot == null) { |
||||
return; |
||||
} |
||||
|
||||
super.populateBean(plot); |
||||
|
||||
if (plot instanceof VanChartBoxPlot) { |
||||
normalValuePane.populate(((VanChartBoxPlot) plot).getNormalValue()); |
||||
outlierValuePane.populate(((VanChartBoxPlot) plot).getOutlierValue()); |
||||
|
||||
checkMarkerPane(((VanChartBoxPlot) plot).isDetailed()); |
||||
} |
||||
} |
||||
|
||||
public void updateBean(Plot plot) { |
||||
if (plot == null) { |
||||
return; |
||||
} |
||||
|
||||
if (plot instanceof VanChartBoxPlot) { |
||||
((VanChartBoxPlot) plot).setNormalValue(normalValuePane.update()); |
||||
((VanChartBoxPlot) plot).setOutlierValue(outlierValuePane.update()); |
||||
} |
||||
|
||||
super.updateBean(plot); |
||||
} |
||||
} |
@ -0,0 +1,21 @@
|
||||
package com.fr.van.chart.box; |
||||
|
||||
import com.fr.design.dialog.BasicPane; |
||||
import com.fr.design.gui.frpane.AttributeChangeListener; |
||||
import com.fr.van.chart.designer.style.VanChartStylePane; |
||||
|
||||
import java.util.List; |
||||
|
||||
public class VanChartBoxStylePane extends VanChartStylePane { |
||||
|
||||
public VanChartBoxStylePane(AttributeChangeListener listener) { |
||||
super(listener); |
||||
} |
||||
|
||||
protected void createVanChartLabelPane(List<BasicPane> paneList) { |
||||
} |
||||
|
||||
protected void addVanChartTooltipPane(List<BasicPane> paneList) { |
||||
paneList.add(new VanChartBoxTooltipPane(VanChartBoxStylePane.this)); |
||||
} |
||||
} |
@ -0,0 +1,149 @@
|
||||
package com.fr.van.chart.box; |
||||
|
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.plugin.chart.base.AttrTooltipContent; |
||||
import com.fr.plugin.chart.box.attr.AttrBoxTooltipContent; |
||||
import com.fr.van.chart.designer.component.VanChartTooltipContentPane; |
||||
import com.fr.van.chart.designer.component.format.CategoryNameFormatPaneWithCheckBox; |
||||
import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithCheckBox; |
||||
import com.fr.van.chart.designer.component.format.VanChartFormatPaneWithCheckBox; |
||||
import com.fr.van.chart.designer.style.VanChartStylePane; |
||||
|
||||
import javax.swing.JPanel; |
||||
import java.awt.Component; |
||||
|
||||
public class VanChartBoxTooltipContentPane extends VanChartTooltipContentPane { |
||||
|
||||
private VanChartFormatPaneWithCheckBox number; |
||||
private VanChartFormatPaneWithCheckBox max; |
||||
private VanChartFormatPaneWithCheckBox q3; |
||||
private VanChartFormatPaneWithCheckBox median; |
||||
private VanChartFormatPaneWithCheckBox q1; |
||||
private VanChartFormatPaneWithCheckBox min; |
||||
private VanChartFormatPaneWithCheckBox outlier; |
||||
|
||||
public VanChartBoxTooltipContentPane(VanChartStylePane parent, JPanel showOnPane) { |
||||
super(parent, showOnPane); |
||||
} |
||||
|
||||
protected void initFormatPane(VanChartStylePane parent, JPanel showOnPane) { |
||||
categoryNameFormatPane = new CategoryNameFormatPaneWithCheckBox(parent, showOnPane); |
||||
seriesNameFormatPane = new SeriesNameFormatPaneWithCheckBox(parent, showOnPane); |
||||
|
||||
number = new VanChartFormatPaneWithCheckBox(parent, showOnPane) { |
||||
protected String getCheckBoxText() { |
||||
return Toolkit.i18nText("Fine-Design_Chart_Data_Number"); |
||||
} |
||||
}; |
||||
max = new VanChartFormatPaneWithCheckBox(parent, showOnPane) { |
||||
protected String getCheckBoxText() { |
||||
return Toolkit.i18nText("Fine-Design_Chart_Max_Value"); |
||||
} |
||||
}; |
||||
q3 = new VanChartFormatPaneWithCheckBox(parent, showOnPane) { |
||||
protected String getCheckBoxText() { |
||||
return Toolkit.i18nText("Fine-Design_Chart_Data_Q3"); |
||||
} |
||||
}; |
||||
median = new VanChartFormatPaneWithCheckBox(parent, showOnPane) { |
||||
protected String getCheckBoxText() { |
||||
return Toolkit.i18nText("Fine-Design_Chart_Data_Median"); |
||||
} |
||||
}; |
||||
q1 = new VanChartFormatPaneWithCheckBox(parent, showOnPane) { |
||||
protected String getCheckBoxText() { |
||||
return Toolkit.i18nText("Fine-Design_Chart_Data_Q1"); |
||||
} |
||||
}; |
||||
min = new VanChartFormatPaneWithCheckBox(parent, showOnPane) { |
||||
protected String getCheckBoxText() { |
||||
return Toolkit.i18nText("Fine-Design_Chart_Min_Value"); |
||||
} |
||||
}; |
||||
outlier = new VanChartFormatPaneWithCheckBox(parent, showOnPane) { |
||||
protected String getCheckBoxText() { |
||||
return Toolkit.i18nText("Fine-Engine_Chart_Outlier_Value"); |
||||
} |
||||
}; |
||||
} |
||||
|
||||
protected double[] getRowSize(double p) { |
||||
return new double[]{p, p, p, p, p, p, p, p, p}; |
||||
} |
||||
|
||||
protected Component[][] getPaneComponents() { |
||||
return new Component[][]{ |
||||
new Component[]{categoryNameFormatPane, null}, |
||||
new Component[]{seriesNameFormatPane, null}, |
||||
new Component[]{number, null}, |
||||
new Component[]{max, null}, |
||||
new Component[]{q3, null}, |
||||
new Component[]{median, null}, |
||||
new Component[]{q1, null}, |
||||
new Component[]{min, null}, |
||||
new Component[]{outlier, null} |
||||
}; |
||||
} |
||||
|
||||
public boolean isDirty() { |
||||
return categoryNameFormatPane.isDirty() |
||||
|| seriesNameFormatPane.isDirty() |
||||
|| number.isDirty() |
||||
|| max.isDirty() |
||||
|| q3.isDirty() |
||||
|| median.isDirty() |
||||
|| q1.isDirty() |
||||
|| min.isDirty() |
||||
|| outlier.isDirty(); |
||||
} |
||||
|
||||
public void setDirty(boolean isDirty) { |
||||
categoryNameFormatPane.setDirty(isDirty); |
||||
seriesNameFormatPane.setDirty(isDirty); |
||||
number.setDirty(isDirty); |
||||
max.setDirty(isDirty); |
||||
q3.setDirty(isDirty); |
||||
median.setDirty(isDirty); |
||||
q1.setDirty(isDirty); |
||||
min.setDirty(isDirty); |
||||
outlier.setDirty(isDirty); |
||||
} |
||||
|
||||
protected AttrTooltipContent createAttrTooltip() { |
||||
return new AttrBoxTooltipContent(); |
||||
} |
||||
|
||||
protected void populateFormatPane(AttrTooltipContent attrTooltipContent) { |
||||
categoryNameFormatPane.populate(attrTooltipContent.getCategoryFormat()); |
||||
seriesNameFormatPane.populate(attrTooltipContent.getSeriesFormat()); |
||||
|
||||
if (attrTooltipContent instanceof AttrBoxTooltipContent) { |
||||
AttrBoxTooltipContent boxTooltipContent = (AttrBoxTooltipContent) attrTooltipContent; |
||||
|
||||
number.populate(boxTooltipContent.getNumber()); |
||||
max.populate(boxTooltipContent.getMax()); |
||||
q3.populate(boxTooltipContent.getQ3()); |
||||
median.populate(boxTooltipContent.getMedian()); |
||||
q1.populate(boxTooltipContent.getQ1()); |
||||
min.populate(boxTooltipContent.getMin()); |
||||
outlier.populate(boxTooltipContent.getOutlier()); |
||||
} |
||||
} |
||||
|
||||
protected void updateFormatPane(AttrTooltipContent attrTooltipContent) { |
||||
categoryNameFormatPane.update(attrTooltipContent.getCategoryFormat()); |
||||
seriesNameFormatPane.update(attrTooltipContent.getSeriesFormat()); |
||||
|
||||
if (attrTooltipContent instanceof AttrBoxTooltipContent) { |
||||
AttrBoxTooltipContent boxTooltipContent = (AttrBoxTooltipContent) attrTooltipContent; |
||||
|
||||
number.update(boxTooltipContent.getNumber()); |
||||
max.update(boxTooltipContent.getMax()); |
||||
q3.update(boxTooltipContent.getQ3()); |
||||
median.update(boxTooltipContent.getMedian()); |
||||
q1.update(boxTooltipContent.getQ1()); |
||||
min.update(boxTooltipContent.getMin()); |
||||
outlier.update(boxTooltipContent.getOutlier()); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,17 @@
|
||||
package com.fr.van.chart.box; |
||||
|
||||
import com.fr.chart.chartattr.Plot; |
||||
import com.fr.van.chart.designer.style.VanChartStylePane; |
||||
import com.fr.van.chart.designer.style.tooltip.VanChartPlotTooltipPane; |
||||
import com.fr.van.chart.designer.style.tooltip.VanChartTooltipPane; |
||||
|
||||
public class VanChartBoxTooltipPane extends VanChartTooltipPane { |
||||
|
||||
public VanChartBoxTooltipPane(VanChartStylePane parent) { |
||||
super(parent); |
||||
} |
||||
|
||||
protected VanChartPlotTooltipPane getTooltipPane(Plot plot) { |
||||
return new VanChartBoxPlotTooltipPane(plot, parent); |
||||
} |
||||
} |
@ -0,0 +1,11 @@
|
||||
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); |
||||
} |
||||
} |
@ -0,0 +1,4 @@
|
||||
package com.fr.van.chart.box.data; |
||||
|
||||
public class BoxPlotReportResultDataSeriesPane { |
||||
} |
@ -0,0 +1,212 @@
|
||||
package com.fr.van.chart.box.data.table; |
||||
|
||||
import com.fr.chart.chartattr.ChartCollection; |
||||
import com.fr.chart.chartattr.Plot; |
||||
import com.fr.chart.chartdata.NormalTableDataDefinition; |
||||
import com.fr.design.foldablepane.UIExpandablePane; |
||||
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.ChartDataFilterPane; |
||||
import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane; |
||||
import com.fr.design.utils.gui.GUICoreUtils; |
||||
import com.fr.plugin.chart.box.VanChartBoxPlot; |
||||
import com.fr.plugin.chart.box.data.VanBoxTableDefinition; |
||||
|
||||
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; |
||||
import java.util.List; |
||||
|
||||
public class BoxPlotTableDataContentPane extends AbstractTableDataContentPane { |
||||
|
||||
private UIButtonGroup dataType; |
||||
|
||||
private BoxPlotTableSeriesTypeUsePane seriesTypeComboxPane; |
||||
private BoxPlotTableResultDataSeriesPane resultDataSeriesPane; |
||||
|
||||
private JPanel filterPane; |
||||
private ChartDataFilterPane dataScreeningPane; |
||||
|
||||
private ChartDataPane parent; |
||||
private Plot initplot; |
||||
|
||||
public BoxPlotTableDataContentPane(Plot plot, ChartDataPane parent) { |
||||
this.initplot = plot; |
||||
this.parent = parent; |
||||
|
||||
this.setLayout(new BorderLayout()); |
||||
|
||||
this.add(createDataTypePane(), BorderLayout.NORTH); |
||||
this.add(createSeriesPane(), BorderLayout.CENTER); |
||||
this.add(createFilterPane(), BorderLayout.SOUTH); |
||||
|
||||
initDataTypeListener(); |
||||
checkDataPaneVisible(); |
||||
} |
||||
|
||||
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() { |
||||
seriesTypeComboxPane = new BoxPlotTableSeriesTypeUsePane(); |
||||
resultDataSeriesPane = new BoxPlotTableResultDataSeriesPane(); |
||||
|
||||
JPanel pane = new JPanel(new BorderLayout(4, 0)); |
||||
|
||||
pane.add(seriesTypeComboxPane, BorderLayout.CENTER); |
||||
pane.add(resultDataSeriesPane, BorderLayout.SOUTH); |
||||
|
||||
return pane; |
||||
} |
||||
|
||||
private JPanel createFilterPane() { |
||||
dataScreeningPane = new ChartDataFilterPane(initplot, parent, false); |
||||
dataScreeningPane.setBorder(BorderFactory.createEmptyBorder(10, 24, 10, 15)); |
||||
|
||||
filterPane = new UIExpandablePane(Toolkit.i18nText("Fine-Design_Chart_Data_Filter"), 290, 24, dataScreeningPane); |
||||
filterPane.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5)); |
||||
|
||||
return filterPane; |
||||
} |
||||
|
||||
private void initDataTypeListener() { |
||||
dataType.addActionListener(new ActionListener() { |
||||
public void actionPerformed(ActionEvent e) { |
||||
checkDataPaneVisible(); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
private void checkDataPaneVisible() { |
||||
if (seriesTypeComboxPane != null) { |
||||
seriesTypeComboxPane.setVisible(dataType.getSelectedIndex() == 0); |
||||
} |
||||
if (resultDataSeriesPane != null) { |
||||
resultDataSeriesPane.setVisible(dataType.getSelectedIndex() == 1); |
||||
} |
||||
|
||||
if (filterPane != null) { |
||||
filterPane.setVisible(dataType.getSelectedIndex() == 0); |
||||
} |
||||
} |
||||
|
||||
public void checkBoxUse(boolean hasUse) { |
||||
if (dataType.getSelectedIndex() == 0 && seriesTypeComboxPane != null) { |
||||
seriesTypeComboxPane.checkBoxUse(hasUse); |
||||
} |
||||
|
||||
if (dataType.getSelectedIndex() == 1 && resultDataSeriesPane != null) { |
||||
resultDataSeriesPane.checkBoxUse(hasUse); |
||||
} |
||||
|
||||
dataScreeningPane.checkBoxUse(); |
||||
} |
||||
|
||||
protected void refreshBoxListWithSelectTableData(List list) { |
||||
if (seriesTypeComboxPane != null) { |
||||
seriesTypeComboxPane.refreshBoxListWithSelectTableData(list); |
||||
} |
||||
if (resultDataSeriesPane != null) { |
||||
resultDataSeriesPane.refreshBoxListWithSelectTableData(list); |
||||
} |
||||
} |
||||
|
||||
public void clearAllBoxList() { |
||||
if (seriesTypeComboxPane != null) { |
||||
seriesTypeComboxPane.clearAllBoxList(); |
||||
} |
||||
if (resultDataSeriesPane != null) { |
||||
resultDataSeriesPane.clearAllBoxList(); |
||||
} |
||||
} |
||||
|
||||
public void updateBean(ChartCollection collection) { |
||||
checkChartCollection(collection); |
||||
|
||||
VanBoxTableDefinition table = BoxTableDefinitionHelper.getBoxTableDefinition(collection); |
||||
|
||||
if (table != null) { |
||||
boolean isDetailed = dataType.getSelectedIndex() == 0; |
||||
|
||||
table.setDetailed(isDetailed); |
||||
((VanChartBoxPlot) initplot).setDetailed(isDetailed); |
||||
} |
||||
if (seriesTypeComboxPane != null) { |
||||
seriesTypeComboxPane.updateBean(collection); |
||||
} |
||||
if (resultDataSeriesPane != null) { |
||||
resultDataSeriesPane.updateBean(collection); |
||||
} |
||||
if (dataScreeningPane != null) { |
||||
updateDataScreeningPane(dataScreeningPane, collection); |
||||
} |
||||
} |
||||
|
||||
public void populateBean(ChartCollection collection) { |
||||
checkChartCollection(collection); |
||||
|
||||
if (dataType != null) { |
||||
dataType.setSelectedIndex(BoxTableDefinitionHelper.isDetailedTableDataType(collection) ? 0 : 1); |
||||
} |
||||
if (seriesTypeComboxPane != null) { |
||||
seriesTypeComboxPane.populateBean(collection); |
||||
} |
||||
if (resultDataSeriesPane != null) { |
||||
resultDataSeriesPane.populateBean(collection); |
||||
} |
||||
if (dataScreeningPane != null) { |
||||
populateDataScreeningPane(dataScreeningPane, collection); |
||||
} |
||||
|
||||
checkDataPaneVisible(); |
||||
} |
||||
|
||||
private void checkChartCollection(ChartCollection collection) { |
||||
VanBoxTableDefinition table = BoxTableDefinitionHelper.getBoxTableDefinition(collection); |
||||
|
||||
if (table == null) { |
||||
collection.getSelectedChart().setFilterDefinition(new VanBoxTableDefinition()); |
||||
} |
||||
} |
||||
|
||||
private void populateDataScreeningPane(ChartDataFilterPane dataScreeningPane, ChartCollection collection) { |
||||
NormalTableDataDefinition detailedDefinition = BoxTableDefinitionHelper.getBoxTableDetailedDefinition(collection); |
||||
|
||||
if (detailedDefinition != null) { |
||||
dataScreeningPane.populateDefinition(detailedDefinition, false); |
||||
} |
||||
} |
||||
|
||||
private void updateDataScreeningPane(ChartDataFilterPane dataScreeningPane, ChartCollection collection) { |
||||
NormalTableDataDefinition detailedDefinition = BoxTableDefinitionHelper.getBoxTableDetailedDefinition(collection); |
||||
|
||||
if (detailedDefinition != null) { |
||||
dataScreeningPane.updateDefinition(detailedDefinition); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,178 @@
|
||||
package com.fr.van.chart.box.data.table; |
||||
|
||||
import com.fr.chart.base.ChartConstants; |
||||
import com.fr.chart.chartattr.ChartCollection; |
||||
import com.fr.design.gui.icombobox.UIComboBox; |
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.design.layout.TableLayout; |
||||
import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane; |
||||
import com.fr.plugin.chart.box.data.VanBoxTableDefinition; |
||||
import com.fr.plugin.chart.box.data.VanBoxTableResultDefinition; |
||||
import com.fr.stable.ArrayUtils; |
||||
import com.fr.stable.StringUtils; |
||||
import com.fr.van.chart.designer.TableLayout4VanChartHelper; |
||||
|
||||
import javax.swing.BorderFactory; |
||||
import javax.swing.JPanel; |
||||
import java.awt.BorderLayout; |
||||
import java.awt.Component; |
||||
import java.awt.Dimension; |
||||
import java.util.List; |
||||
|
||||
public class BoxPlotTableResultDataSeriesPane extends AbstractTableDataContentPane { |
||||
|
||||
private UIComboBox category; |
||||
private UIComboBox seriesName; |
||||
private UIComboBox max; |
||||
private UIComboBox q3; |
||||
private UIComboBox median; |
||||
private UIComboBox q1; |
||||
private UIComboBox min; |
||||
|
||||
public BoxPlotTableResultDataSeriesPane() { |
||||
|
||||
initComboxSize(); |
||||
|
||||
this.setLayout(new BorderLayout()); |
||||
this.add(createDataSeriesPane(), BorderLayout.CENTER); |
||||
|
||||
addItemListener(); |
||||
} |
||||
|
||||
private void initComboxSize() { |
||||
Dimension preferredSize = new Dimension(100, 20); |
||||
|
||||
category = new UIComboBox(); |
||||
seriesName = new UIComboBox(); |
||||
max = new UIComboBox(); |
||||
q3 = new UIComboBox(); |
||||
median = new UIComboBox(); |
||||
q1 = new UIComboBox(); |
||||
min = new UIComboBox(); |
||||
|
||||
category.setPreferredSize(preferredSize); |
||||
seriesName.setPreferredSize(preferredSize); |
||||
max.setPreferredSize(preferredSize); |
||||
q3.setPreferredSize(preferredSize); |
||||
median.setPreferredSize(preferredSize); |
||||
q1.setPreferredSize(preferredSize); |
||||
min.setPreferredSize(preferredSize); |
||||
} |
||||
|
||||
private void addItemListener() { |
||||
category.addItemListener(tooltipListener); |
||||
seriesName.addItemListener(tooltipListener); |
||||
max.addItemListener(tooltipListener); |
||||
q3.addItemListener(tooltipListener); |
||||
median.addItemListener(tooltipListener); |
||||
q1.addItemListener(tooltipListener); |
||||
min.addItemListener(tooltipListener); |
||||
} |
||||
|
||||
private JPanel createDataSeriesPane() { |
||||
double p = TableLayout.PREFERRED; |
||||
double f = TableLayout.FILL; |
||||
|
||||
double[] column = {f, COMPONENT_WIDTH}; |
||||
double[] row = {p, p, p, p, p, p, p}; |
||||
|
||||
Component[][] components_north = new Component[][]{ |
||||
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Category")), category}, |
||||
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Series_Name")), seriesName}, |
||||
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Data_Max")), max}, |
||||
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Data_Q3")), q3}, |
||||
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Data_Median")), median}, |
||||
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Data_Q1")), q1}, |
||||
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Data_Min")), min}, |
||||
}; |
||||
|
||||
JPanel center = TableLayout4VanChartHelper.createGapTableLayoutPane(components_north, row, column); |
||||
center.setBorder(BorderFactory.createEmptyBorder(10, 24, 10, 15)); |
||||
|
||||
return center; |
||||
} |
||||
|
||||
public void checkBoxUse(boolean hasUse) { |
||||
} |
||||
|
||||
protected void refreshBoxListWithSelectTableData(List list) { |
||||
refreshBoxItems(category, list); |
||||
refreshBoxItems(seriesName, list); |
||||
refreshBoxItems(max, list); |
||||
refreshBoxItems(q3, list); |
||||
refreshBoxItems(median, list); |
||||
refreshBoxItems(q1, list); |
||||
refreshBoxItems(min, list); |
||||
} |
||||
|
||||
public void clearAllBoxList() { |
||||
clearBoxItems(category); |
||||
clearBoxItems(seriesName); |
||||
clearBoxItems(max); |
||||
clearBoxItems(q3); |
||||
clearBoxItems(median); |
||||
clearBoxItems(q1); |
||||
clearBoxItems(min); |
||||
} |
||||
|
||||
public void populateBean(ChartCollection collection) { |
||||
super.populateBean(collection); |
||||
|
||||
VanBoxTableResultDefinition definition = BoxTableDefinitionHelper.getBoxTableResultDefinition(collection); |
||||
|
||||
if (definition == null) { |
||||
return; |
||||
} |
||||
|
||||
combineCustomEditValue(category, definition.getCategoryName()); |
||||
combineCustomEditValue(seriesName, definition.getSeriesName()); |
||||
combineCustomEditValue(max, definition.getMax()); |
||||
combineCustomEditValue(q3, definition.getQ3()); |
||||
combineCustomEditValue(median, definition.getMedian()); |
||||
combineCustomEditValue(q1, definition.getQ1()); |
||||
combineCustomEditValue(min, definition.getMin()); |
||||
} |
||||
|
||||
public void updateBean(ChartCollection collection) { |
||||
VanBoxTableDefinition table = BoxTableDefinitionHelper.getBoxTableDefinition(collection); |
||||
|
||||
VanBoxTableResultDefinition definition = new VanBoxTableResultDefinition(); |
||||
|
||||
Object resultCategory = category.getSelectedItem(); |
||||
Object resultSeries = seriesName.getSelectedItem(); |
||||
Object resultMax = max.getSelectedItem(); |
||||
Object resultQ3 = q3.getSelectedItem(); |
||||
Object resultMedian = median.getSelectedItem(); |
||||
Object resultQ1 = q1.getSelectedItem(); |
||||
Object resultMin = min.getSelectedItem(); |
||||
|
||||
if (resultCategory == null || ArrayUtils.contains(ChartConstants.getNoneKeys(), resultCategory)) { |
||||
definition.setCategoryName(StringUtils.EMPTY); |
||||
} else { |
||||
definition.setCategoryName(resultCategory.toString()); |
||||
} |
||||
if (resultSeries == null || ArrayUtils.contains(ChartConstants.getNoneKeys(), resultSeries)) { |
||||
definition.setSeriesName(StringUtils.EMPTY); |
||||
} else { |
||||
definition.setSeriesName(resultSeries.toString()); |
||||
} |
||||
if (resultMax != null) { |
||||
definition.setMax(resultMax.toString()); |
||||
} |
||||
if (resultQ3 != null) { |
||||
definition.setQ3(resultQ3.toString()); |
||||
} |
||||
if (resultMedian != null) { |
||||
definition.setMedian(resultMedian.toString()); |
||||
} |
||||
if (resultQ1 != null) { |
||||
definition.setQ1(resultQ1.toString()); |
||||
} |
||||
if (resultMin != null) { |
||||
definition.setMin(resultMin.toString()); |
||||
} |
||||
|
||||
table.setResultDefinition(definition); |
||||
} |
||||
} |
@ -0,0 +1,12 @@
|
||||
package com.fr.van.chart.box.data.table; |
||||
|
||||
import com.fr.chart.chartdata.MoreNameCDDefinition; |
||||
import com.fr.design.mainframe.chart.gui.data.table.SeriesNameUseFieldNamePane; |
||||
import com.fr.plugin.chart.box.data.VanBoxMoreNameCDDefinition; |
||||
|
||||
public class BoxPlotTableSeriesNameUseFieldNamePane extends SeriesNameUseFieldNamePane { |
||||
|
||||
protected MoreNameCDDefinition createMoreNameCDDefinition() { |
||||
return new VanBoxMoreNameCDDefinition(); |
||||
} |
||||
} |
@ -0,0 +1,12 @@
|
||||
package com.fr.van.chart.box.data.table; |
||||
|
||||
import com.fr.chart.chartdata.OneValueCDDefinition; |
||||
import com.fr.design.mainframe.chart.gui.data.table.SeriesNameUseFieldValuePane; |
||||
import com.fr.plugin.chart.box.data.VanBoxOneValueCDDefinition; |
||||
|
||||
public class BoxPlotTableSeriesNameUseFieldValuePane extends SeriesNameUseFieldValuePane { |
||||
|
||||
protected OneValueCDDefinition createOneValueCDDefinition() { |
||||
return new VanBoxOneValueCDDefinition(); |
||||
} |
||||
} |
@ -0,0 +1,224 @@
|
||||
package com.fr.van.chart.box.data.table; |
||||
|
||||
import com.fr.chart.base.ChartConstants; |
||||
import com.fr.chart.chartattr.ChartCollection; |
||||
import com.fr.chart.chartdata.MoreNameCDDefinition; |
||||
import com.fr.chart.chartdata.NormalTableDataDefinition; |
||||
import com.fr.chart.chartdata.OneValueCDDefinition; |
||||
import com.fr.design.beans.FurtherBasicBeanPane; |
||||
import com.fr.design.constants.LayoutConstants; |
||||
import com.fr.design.gui.frpane.UIComboBoxPane; |
||||
import com.fr.design.gui.icombobox.UIComboBox; |
||||
import com.fr.design.gui.ilable.BoldFontTextLabel; |
||||
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.table.DataPaneHelper; |
||||
import com.fr.design.utils.gui.GUICoreUtils; |
||||
import com.fr.design.utils.gui.UIComponentUtils; |
||||
import com.fr.general.ComparatorUtils; |
||||
import com.fr.plugin.chart.box.data.VanBoxTableDefinition; |
||||
import com.fr.stable.ArrayUtils; |
||||
import com.fr.stable.StringUtils; |
||||
|
||||
import javax.swing.BorderFactory; |
||||
import javax.swing.JPanel; |
||||
import java.awt.BorderLayout; |
||||
import java.awt.Component; |
||||
import java.awt.Dimension; |
||||
import java.awt.event.ItemEvent; |
||||
import java.awt.event.ItemListener; |
||||
import java.util.ArrayList; |
||||
import java.util.List; |
||||
|
||||
public class BoxPlotTableSeriesTypeUsePane extends UIComboBoxPane<ChartCollection> { |
||||
|
||||
private static boolean NEED_SUMMERY = false; |
||||
|
||||
private UIComboBox categoryCombox; |
||||
|
||||
private BoxPlotTableSeriesNameUseFieldValuePane nameFieldValuePane; |
||||
private BoxPlotTableSeriesNameUseFieldNamePane nameFieldNamePane; |
||||
|
||||
public BoxPlotTableSeriesTypeUsePane() { |
||||
cards = initPaneList(); |
||||
initComponents(); |
||||
initListener(); |
||||
} |
||||
|
||||
protected void initLayout() { |
||||
this.setLayout(new BorderLayout(4, LayoutConstants.VGAP_MEDIUM)); |
||||
|
||||
cardPane.setBorder(BorderFactory.createEmptyBorder(0, 24, 0, 15)); |
||||
|
||||
this.add(createNorthPane(), BorderLayout.NORTH); |
||||
this.add(createCenterPane(), BorderLayout.CENTER); |
||||
this.add(cardPane, BorderLayout.SOUTH); |
||||
} |
||||
|
||||
protected UIComboBox createComboBox() { |
||||
UIComboBox uiComboBox = new UIComboBox(); |
||||
UIComponentUtils.setPreferedWidth(uiComboBox, 100); |
||||
return uiComboBox; |
||||
} |
||||
|
||||
private JPanel createNorthPane() { |
||||
JPanel north = new JPanel(new BorderLayout(4, 0)); |
||||
north.setBorder(BorderFactory.createMatteBorder(0, 0, 6, 1, getBackground())); |
||||
UILabel label = new BoldFontTextLabel(Toolkit.i18nText("Fine-Design_Chart_Style_Category")); |
||||
label.setPreferredSize(new Dimension(ChartDataPane.LABEL_WIDTH, ChartDataPane.LABEL_HEIGHT)); |
||||
|
||||
categoryCombox = new UIComboBox(); |
||||
categoryCombox.setPreferredSize(new Dimension(100, 20)); |
||||
categoryCombox.addItem(Toolkit.i18nText("Fine-Design_Chart_Use_None")); |
||||
|
||||
north.add(GUICoreUtils.createBorderLayoutPane(new Component[]{categoryCombox, null, null, label, null})); |
||||
north.setPreferredSize(new Dimension(246, 30)); |
||||
north.setBorder(BorderFactory.createEmptyBorder(0, 24, 10, 15)); |
||||
|
||||
return north; |
||||
} |
||||
|
||||
private JPanel createCenterPane() { |
||||
JPanel center = new JPanel(new BorderLayout(4, 0)); |
||||
|
||||
UILabel label = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Series_Name_From")); |
||||
label.setPreferredSize(new Dimension(ChartDataPane.LABEL_WIDTH, ChartDataPane.LABEL_HEIGHT)); |
||||
center.add(GUICoreUtils.createBorderLayoutPane(new Component[]{jcb, null, null, label, null})); |
||||
center.setBorder(BorderFactory.createEmptyBorder(0, 24, 0, 15)); |
||||
|
||||
return center; |
||||
} |
||||
|
||||
private void initListener() { |
||||
categoryCombox.addItemListener(new ItemListener() { |
||||
public void itemStateChanged(ItemEvent e) { |
||||
checkBoxUse(categoryCombox.getSelectedItem() != null); |
||||
makeToolTipUse(categoryCombox); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
public void checkBoxUse(boolean hasUse) { |
||||
categoryCombox.setEnabled(hasUse); |
||||
jcb.setEnabled(hasUse); |
||||
nameFieldValuePane.checkUse(hasUse); |
||||
} |
||||
|
||||
private void makeToolTipUse(UIComboBox comBox) { |
||||
if (comBox.getSelectedItem() != null) { |
||||
comBox.setToolTipText(comBox.getSelectedItem().toString()); |
||||
} else { |
||||
comBox.setToolTipText(null); |
||||
} |
||||
} |
||||
|
||||
public void refreshBoxListWithSelectTableData(List list) { |
||||
DataPaneHelper.refreshBoxItems(categoryCombox, list); |
||||
|
||||
categoryCombox.addItem(Toolkit.i18nText("Fine-Design_Chart_Use_None")); |
||||
|
||||
nameFieldValuePane.refreshBoxListWithSelectTableData(list); |
||||
nameFieldNamePane.refreshBoxListWithSelectTableData(list); |
||||
} |
||||
|
||||
public void clearAllBoxList() { |
||||
DataPaneHelper.clearBoxItems(categoryCombox); |
||||
|
||||
categoryCombox.addItem(Toolkit.i18nText("Fine-Design_Chart_Use_None")); |
||||
|
||||
nameFieldValuePane.clearAllBoxList(); |
||||
nameFieldNamePane.clearAllBoxList(); |
||||
} |
||||
|
||||
protected String title4PopupWindow() { |
||||
return Toolkit.i18nText("Fine-Design_Chart_Series_Name_From"); |
||||
} |
||||
|
||||
protected List<FurtherBasicBeanPane<? extends ChartCollection>> initPaneList() { |
||||
nameFieldValuePane = new BoxPlotTableSeriesNameUseFieldValuePane(); |
||||
nameFieldNamePane = new BoxPlotTableSeriesNameUseFieldNamePane(); |
||||
|
||||
nameFieldValuePane.relayoutPane(NEED_SUMMERY); |
||||
nameFieldNamePane.relayoutPane(NEED_SUMMERY); |
||||
|
||||
List<FurtherBasicBeanPane<? extends ChartCollection>> paneList = new ArrayList<FurtherBasicBeanPane<? extends ChartCollection>>(); |
||||
|
||||
paneList.add(nameFieldValuePane); |
||||
paneList.add(nameFieldNamePane); |
||||
|
||||
return paneList; |
||||
} |
||||
|
||||
public void relayoutPane() { |
||||
if (jcb.getSelectedIndex() == 0) { |
||||
nameFieldValuePane.relayoutPane(NEED_SUMMERY); |
||||
} else { |
||||
nameFieldNamePane.relayoutPane(NEED_SUMMERY); |
||||
} |
||||
} |
||||
|
||||
protected void comboBoxItemStateChanged() { |
||||
if (jcb.getSelectedIndex() == 0) { |
||||
nameFieldValuePane.relayoutPane(NEED_SUMMERY); |
||||
} else { |
||||
nameFieldNamePane.relayoutPane(NEED_SUMMERY); |
||||
} |
||||
} |
||||
|
||||
public void populateBean(ChartCollection collection) { |
||||
NormalTableDataDefinition definition = BoxTableDefinitionHelper.getBoxTableDetailedDefinition(collection); |
||||
|
||||
if (definition == null) { |
||||
categoryCombox.setSelectedItem(Toolkit.i18nText("Fine-Design_Chart_Use_None")); |
||||
return; |
||||
} |
||||
|
||||
if (definition instanceof OneValueCDDefinition) { |
||||
this.setSelectedIndex(0); |
||||
nameFieldValuePane.populateDefinition(definition, NEED_SUMMERY); |
||||
} else if (definition instanceof MoreNameCDDefinition) { |
||||
this.setSelectedIndex(1); |
||||
nameFieldNamePane.populateDefinition(definition, NEED_SUMMERY); |
||||
} |
||||
|
||||
populateCategoryItem(categoryCombox, definition.getCategoryName()); |
||||
} |
||||
|
||||
public void updateBean(ChartCollection collection) { |
||||
VanBoxTableDefinition table = BoxTableDefinitionHelper.getBoxTableDefinition(collection); |
||||
|
||||
if (table == null) { |
||||
return; |
||||
} |
||||
|
||||
NormalTableDataDefinition definition; |
||||
|
||||
if (this.getSelectedIndex() == 0) { |
||||
definition = nameFieldValuePane.updateDefinition(); |
||||
} else { |
||||
definition = nameFieldNamePane.updateDefinition(table.getDetailedDefinition()); |
||||
} |
||||
|
||||
Object categoryName = categoryCombox.getSelectedItem(); |
||||
|
||||
if (ArrayUtils.contains(ChartConstants.getNoneKeys(), categoryName)) { |
||||
definition.setCategoryName(StringUtils.EMPTY); |
||||
} else { |
||||
definition.setCategoryName(categoryName == null ? null : categoryName.toString()); |
||||
} |
||||
|
||||
table.setDetailedDefinition(definition); |
||||
} |
||||
|
||||
private void populateCategoryItem(UIComboBox categoryCombox, String item) { |
||||
if (ComparatorUtils.equals(item, StringUtils.EMPTY)) { |
||||
categoryCombox.setSelectedItem(Toolkit.i18nText("Fine-Design_Chart_Use_None")); |
||||
} else if (!DataPaneHelper.boxItemsContainsObject(categoryCombox, item)) { |
||||
categoryCombox.setSelectedItem(null); |
||||
} else { |
||||
DataPaneHelper.combineCustomEditValue(categoryCombox, item); |
||||
} |
||||
} |
||||
|
||||
} |
@ -0,0 +1,59 @@
|
||||
package com.fr.van.chart.box.data.table; |
||||
|
||||
import com.fr.base.chart.chartdata.TopDefinitionProvider; |
||||
import com.fr.chart.chartattr.Chart; |
||||
import com.fr.chart.chartattr.ChartCollection; |
||||
import com.fr.chart.chartdata.NormalTableDataDefinition; |
||||
import com.fr.plugin.chart.box.data.VanBoxTableDefinition; |
||||
import com.fr.plugin.chart.box.data.VanBoxTableResultDefinition; |
||||
|
||||
public class BoxTableDefinitionHelper { |
||||
|
||||
public static VanBoxTableDefinition getBoxTableDefinition(ChartCollection collection) { |
||||
if (collection != null) { |
||||
|
||||
Chart chart = collection.getSelectedChart(); |
||||
|
||||
if (chart != null) { |
||||
TopDefinitionProvider definitionProvider = chart.getFilterDefinition(); |
||||
|
||||
if (definitionProvider instanceof VanBoxTableDefinition) { |
||||
return (VanBoxTableDefinition) definitionProvider; |
||||
} |
||||
} |
||||
} |
||||
|
||||
return null; |
||||
} |
||||
|
||||
public static VanBoxTableResultDefinition getBoxTableResultDefinition(ChartCollection collection) { |
||||
VanBoxTableDefinition table = getBoxTableDefinition(collection); |
||||
|
||||
if (table != null) { |
||||
return table.getResultDefinition(); |
||||
} |
||||
|
||||
return null; |
||||
} |
||||
|
||||
public static NormalTableDataDefinition getBoxTableDetailedDefinition(ChartCollection collection) { |
||||
VanBoxTableDefinition table = getBoxTableDefinition(collection); |
||||
|
||||
if (table != null) { |
||||
return table.getDetailedDefinition(); |
||||
} |
||||
|
||||
return null; |
||||
} |
||||
|
||||
public static boolean isDetailedTableDataType(ChartCollection collection) { |
||||
VanBoxTableDefinition table = getBoxTableDefinition(collection); |
||||
|
||||
if (table != null) { |
||||
return table.isDetailed(); |
||||
} |
||||
|
||||
return true; |
||||
} |
||||
} |
||||
|
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 918 B |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue