103 changed files with 3061 additions and 970 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,143 @@ |
|||||||
|
package com.fr.design.chart.auto; |
||||||
|
|
||||||
|
import com.fr.chart.auto.ColumnInfo; |
||||||
|
import com.fr.chart.auto.strategy.AutoTypeStrategy; |
||||||
|
import com.fr.chart.auto.strategy.imp.AvaStrategy; |
||||||
|
import com.fr.chart.auto.strategy.imp.BubbleChartStrategy; |
||||||
|
import com.fr.chart.auto.strategy.imp.SingleDimensionStrategy; |
||||||
|
import com.fr.chart.auto.strategy.imp.SingleTargetStrategy; |
||||||
|
import com.fr.data.TableDataSource; |
||||||
|
import com.fr.data.TableDataSourceTailor; |
||||||
|
import com.fr.data.impl.EmbeddedTableData; |
||||||
|
import com.fr.data.impl.NameTableData; |
||||||
|
import com.fr.design.data.DesignTableDataManager; |
||||||
|
import com.fr.design.file.HistoryTemplateListCache; |
||||||
|
import com.fr.general.ComparatorUtils; |
||||||
|
import com.fr.general.GeneralUtils; |
||||||
|
import com.fr.general.data.DataModel; |
||||||
|
import com.fr.log.FineLoggerFactory; |
||||||
|
import com.fr.plugin.chart.vanchart.VanChart; |
||||||
|
import com.fr.script.Calculator; |
||||||
|
import com.fr.stable.StringUtils; |
||||||
|
|
||||||
|
import java.util.ArrayList; |
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author Bjorn |
||||||
|
* @version 10.0 |
||||||
|
* Created by Bjorn on 2020-05-08 |
||||||
|
*/ |
||||||
|
public class AutoTypeCalculate { |
||||||
|
|
||||||
|
public static List<VanChart> calculateType(String tableName, List<String> columns) { |
||||||
|
List<ColumnInfo> columnValue = calculateField(tableName, columns); |
||||||
|
if (columnValue.isEmpty()) { |
||||||
|
return new ArrayList<>(); |
||||||
|
} |
||||||
|
|
||||||
|
List<ColumnInfo> dimensions = new ArrayList<>(); |
||||||
|
List<ColumnInfo> targets = new ArrayList<>(); |
||||||
|
for (ColumnInfo field : columnValue) { |
||||||
|
if (isTarget(field.getValues())) { |
||||||
|
targets.add(field); |
||||||
|
} else { |
||||||
|
dimensions.add(field); |
||||||
|
} |
||||||
|
} |
||||||
|
AutoTypeStrategy autoTypeStrategy = chooseStrategy(dimensions.size(), targets.size()); |
||||||
|
return autoTypeStrategy.rankChart(tableName, dimensions, targets); |
||||||
|
} |
||||||
|
|
||||||
|
private static AutoTypeStrategy chooseStrategy(int dimensionSize, int targetSize) { |
||||||
|
if (dimensionSize == 0) { |
||||||
|
//没有维度,并且只有一个指标,使用单指标匹配逻辑,大于1个指标,使用气泡图(散点图)匹配逻辑
|
||||||
|
if (targetSize == 1) { |
||||||
|
return new SingleTargetStrategy(); |
||||||
|
} else { |
||||||
|
return new BubbleChartStrategy(); |
||||||
|
} |
||||||
|
} else if (dimensionSize == 1) { |
||||||
|
//1个维度,并且没有指标,使用单维度匹配,2~3个指标,使用气泡图(散点图)匹配逻辑,其余使用ava匹配
|
||||||
|
if (targetSize == 0) { |
||||||
|
return new SingleDimensionStrategy(); |
||||||
|
} else if (targetSize == 2 || targetSize == 3) { |
||||||
|
return new BubbleChartStrategy(); |
||||||
|
} else { |
||||||
|
return new AvaStrategy(); |
||||||
|
} |
||||||
|
} else { |
||||||
|
//大与1个维度,并且没有指标,使用单维度匹配(循环),否则使用ava匹配
|
||||||
|
if (targetSize == 0) { |
||||||
|
return new SingleDimensionStrategy(); |
||||||
|
} else { |
||||||
|
return new AvaStrategy(); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
private static boolean isTarget(List<String> values) { |
||||||
|
for (String value : values) { |
||||||
|
if (StringUtils.isEmpty(value)) { |
||||||
|
continue; |
||||||
|
} |
||||||
|
Number number = GeneralUtils.string2Number(value); |
||||||
|
if (number == null) { |
||||||
|
return false; |
||||||
|
} |
||||||
|
} |
||||||
|
return true; |
||||||
|
} |
||||||
|
|
||||||
|
private static List<ColumnInfo> calculateField(String tableName, List<String> columns) { |
||||||
|
NameTableData nameTableData = new NameTableData(tableName); |
||||||
|
TableDataSource dataSource = TableDataSourceTailor.extractTableData(HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().getTarget()); |
||||||
|
Calculator calculator = Calculator.createCalculator(); |
||||||
|
calculator.setAttribute(TableDataSource.KEY, dataSource); |
||||||
|
nameTableData.createTableData(calculator); |
||||||
|
|
||||||
|
EmbeddedTableData tableData; |
||||||
|
try { |
||||||
|
tableData = DesignTableDataManager.previewTableDataNeedInputParameters(dataSource, nameTableData, Integer.MAX_VALUE, false); |
||||||
|
} catch (Exception e) { |
||||||
|
FineLoggerFactory.getLogger().error(e.getMessage(), e); |
||||||
|
return new ArrayList<>(); |
||||||
|
} |
||||||
|
|
||||||
|
List<ColumnInfo> originalData = new ArrayList<>(); |
||||||
|
for (String column : columns) { |
||||||
|
List<String> columnData = getColumnData(tableData, column); |
||||||
|
if (columnData != null && !columnData.isEmpty()) { |
||||||
|
originalData.add(new ColumnInfo(column, columnData)); |
||||||
|
} |
||||||
|
} |
||||||
|
return originalData; |
||||||
|
} |
||||||
|
|
||||||
|
private static List<String> getColumnData(EmbeddedTableData tableData, String columnName) { |
||||||
|
List<String> columnData = new ArrayList<>(); |
||||||
|
|
||||||
|
int colIndex = getColIndex(tableData, columnName); |
||||||
|
if (colIndex == DataModel.COLUMN_NAME_NOT_FOUND) { |
||||||
|
return columnData; |
||||||
|
} |
||||||
|
|
||||||
|
int size = tableData.getRowCount(); |
||||||
|
for (int i = 0; i < size; i++) { |
||||||
|
Object valueAt = tableData.getValueAt(i, colIndex); |
||||||
|
columnData.add(GeneralUtils.objectToString(valueAt)); |
||||||
|
} |
||||||
|
return columnData; |
||||||
|
} |
||||||
|
|
||||||
|
private static int getColIndex(EmbeddedTableData tableData, String columnName) { |
||||||
|
int colIndex = 0; |
||||||
|
|
||||||
|
for (int count = tableData.getColumnCount(); colIndex < count; ++colIndex) { |
||||||
|
if (ComparatorUtils.tableDataColumnNameEquals(tableData.getColumnName(colIndex), columnName)) { |
||||||
|
return colIndex; |
||||||
|
} |
||||||
|
} |
||||||
|
return DataModel.COLUMN_NAME_NOT_FOUND; |
||||||
|
} |
||||||
|
} |
@ -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,20 @@ |
|||||||
|
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; |
||||||
|
|
||||||
|
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 boolean hasTooltipSeriesType() { |
||||||
|
return false; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,12 @@ |
|||||||
|
package com.fr.van.chart.box; |
||||||
|
|
||||||
|
import com.fr.chart.chartattr.Plot; |
||||||
|
import com.fr.design.mainframe.chart.gui.ChartStylePane; |
||||||
|
import com.fr.van.chart.column.VanChartColumnSeriesPane; |
||||||
|
|
||||||
|
public class VanChartBoxSeriesPane extends VanChartColumnSeriesPane { |
||||||
|
|
||||||
|
public VanChartBoxSeriesPane(ChartStylePane parent, Plot plot) { |
||||||
|
super(parent, 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.bar.VanChartBarStylePane; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
public class VanChartBoxStylePane extends VanChartBarStylePane { |
||||||
|
|
||||||
|
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,28 @@ |
|||||||
|
package com.fr.van.chart.box; |
||||||
|
|
||||||
|
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.style.VanChartStylePane; |
||||||
|
|
||||||
|
import javax.swing.JPanel; |
||||||
|
import java.awt.Component; |
||||||
|
|
||||||
|
public class VanChartBoxTooltipContentPane extends VanChartTooltipContentPane { |
||||||
|
|
||||||
|
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); |
||||||
|
} |
||||||
|
|
||||||
|
protected Component[][] getPaneComponents() { |
||||||
|
return new Component[][]{ |
||||||
|
new Component[]{categoryNameFormatPane, null}, |
||||||
|
new Component[]{seriesNameFormatPane, null} |
||||||
|
}; |
||||||
|
} |
||||||
|
} |
@ -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,213 @@ |
|||||||
|
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.data.VanBoxTableDefinition; |
||||||
|
import com.fr.plugin.chart.box.data.VanBoxTableDefinitionHelper; |
||||||
|
import com.fr.plugin.chart.box.data.VanBoxTableResultDefinition; |
||||||
|
|
||||||
|
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 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)); |
||||||
|
|
||||||
|
JPanel panel = new UIExpandablePane(Toolkit.i18nText("Fine-Design_Chart_Data_Filter"), 290, 24, dataScreeningPane); |
||||||
|
panel.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5)); |
||||||
|
|
||||||
|
return panel; |
||||||
|
} |
||||||
|
|
||||||
|
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); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
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 = VanBoxTableDefinitionHelper.getBoxTableDefinition(collection); |
||||||
|
|
||||||
|
if (table != null) { |
||||||
|
table.setDetailed(dataType.getSelectedIndex() == 0); |
||||||
|
} |
||||||
|
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(VanBoxTableDefinitionHelper.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 = VanBoxTableDefinitionHelper.getBoxTableDefinition(collection); |
||||||
|
|
||||||
|
if (table == null) { |
||||||
|
collection.getSelectedChart().setFilterDefinition(new VanBoxTableDefinition()); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
private void populateDataScreeningPane(ChartDataFilterPane dataScreeningPane, ChartCollection collection) { |
||||||
|
NormalTableDataDefinition detailedDefinition = VanBoxTableDefinitionHelper.getBoxTableDetailedDefinition(collection); |
||||||
|
VanBoxTableResultDefinition resultDefinition = VanBoxTableDefinitionHelper.getBoxTableResultDefinition(collection); |
||||||
|
|
||||||
|
if (detailedDefinition != null) { |
||||||
|
dataScreeningPane.populateDefinition(detailedDefinition, false); |
||||||
|
} else if (resultDefinition != null) { |
||||||
|
dataScreeningPane.populateDefinition(resultDefinition, false); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
private void updateDataScreeningPane(ChartDataFilterPane dataScreeningPane, ChartCollection collection) { |
||||||
|
NormalTableDataDefinition detailedDefinition = VanBoxTableDefinitionHelper.getBoxTableDetailedDefinition(collection); |
||||||
|
VanBoxTableResultDefinition resultDefinition = VanBoxTableDefinitionHelper.getBoxTableResultDefinition(collection); |
||||||
|
|
||||||
|
if (detailedDefinition != null) { |
||||||
|
dataScreeningPane.updateDefinition(detailedDefinition); |
||||||
|
} |
||||||
|
|
||||||
|
if (resultDefinition != null) { |
||||||
|
dataScreeningPane.updateDefinition(resultDefinition); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,179 @@ |
|||||||
|
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.VanBoxTableDefinitionHelper; |
||||||
|
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 = VanBoxTableDefinitionHelper.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 = VanBoxTableDefinitionHelper.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,225 @@ |
|||||||
|
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.plugin.chart.box.data.VanBoxTableDefinitionHelper; |
||||||
|
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 = VanBoxTableDefinitionHelper.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 = VanBoxTableDefinitionHelper.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); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
} |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 918 B |
@ -0,0 +1,46 @@ |
|||||||
|
package com.fr.design.designer.beans.adapters.layout; |
||||||
|
|
||||||
|
import com.fr.config.dao.DaoContext; |
||||||
|
import com.fr.config.dao.impl.LocalClassHelperDao; |
||||||
|
import com.fr.config.dao.impl.LocalEntityDao; |
||||||
|
import com.fr.config.dao.impl.LocalXmlEntityDao; |
||||||
|
import com.fr.design.designer.creator.XButton; |
||||||
|
import com.fr.design.designer.creator.XCreator; |
||||||
|
import com.fr.design.designer.creator.XWAbsoluteLayout; |
||||||
|
import com.fr.form.ui.Button; |
||||||
|
import com.fr.form.ui.container.WAbsoluteLayout; |
||||||
|
import java.awt.Dimension; |
||||||
|
import junit.framework.TestCase; |
||||||
|
import org.junit.Assert; |
||||||
|
|
||||||
|
public class FRAbsoluteLayoutAdapterTest extends TestCase { |
||||||
|
@Override |
||||||
|
protected void setUp() throws Exception { |
||||||
|
DaoContext.setEntityDao(new LocalEntityDao()); |
||||||
|
DaoContext.setClassHelperDao(new LocalClassHelperDao()); |
||||||
|
DaoContext.setXmlEntityDao(new LocalXmlEntityDao()); |
||||||
|
} |
||||||
|
|
||||||
|
public void testFix(){ |
||||||
|
WAbsoluteLayout layout =new WAbsoluteLayout(); |
||||||
|
XWAbsoluteLayout container =new XWAbsoluteLayout(layout); |
||||||
|
container.setBounds(0,320,400,160); |
||||||
|
FRAbsoluteLayoutAdapter frAbsoluteLayoutAdapter = new FRAbsoluteLayoutAdapter(container); |
||||||
|
XCreator button = new XButton(new Button(),new Dimension(88,40)); |
||||||
|
|
||||||
|
frAbsoluteLayoutAdapter.fix(button,-1,-1); |
||||||
|
Assert.assertEquals(0,button.getX()); |
||||||
|
Assert.assertEquals(0,button.getY()); |
||||||
|
|
||||||
|
frAbsoluteLayoutAdapter.fix(button,350,200); |
||||||
|
Assert.assertEquals(312,button.getX()); |
||||||
|
Assert.assertEquals(120,button.getY()); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected void tearDown() throws Exception { |
||||||
|
DaoContext.setEntityDao(null); |
||||||
|
DaoContext.setClassHelperDao(null); |
||||||
|
DaoContext.setXmlEntityDao(null); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,38 @@ |
|||||||
|
package com.fr.design.mainframe; |
||||||
|
|
||||||
|
import com.fr.chart.chartattr.ChartCollection; |
||||||
|
import com.fr.design.designer.creator.XCreator; |
||||||
|
import com.fr.form.share.SharableWidgetProvider; |
||||||
|
import com.fr.form.ui.ChartEditor; |
||||||
|
import com.fr.general.ImageWithSuffix; |
||||||
|
import com.fr.invoke.Reflect; |
||||||
|
import org.easymock.EasyMock; |
||||||
|
import org.junit.Assert; |
||||||
|
import org.junit.Test; |
||||||
|
import org.junit.runner.RunWith; |
||||||
|
import org.powermock.core.classloader.annotations.PowerMockIgnore; |
||||||
|
import org.powermock.modules.junit4.PowerMockRunner; |
||||||
|
|
||||||
|
@RunWith(PowerMockRunner.class) |
||||||
|
@PowerMockIgnore({"com.fr.jvm.assist.*", "javax.swing.*"}) |
||||||
|
public class ShareWidgetButtonTest { |
||||||
|
|
||||||
|
@Test |
||||||
|
public void testCreateXCreator() throws Exception { |
||||||
|
|
||||||
|
SharableWidgetProvider provider = EasyMock.mock(SharableWidgetProvider.class); |
||||||
|
EasyMock.expect(provider.getWidth()).andReturn(300).anyTimes(); |
||||||
|
EasyMock.expect(provider.getHeight()).andReturn(400).anyTimes(); |
||||||
|
EasyMock.expect(provider.getName()).andReturn("test-drag").anyTimes(); |
||||||
|
EasyMock.expect(provider.getCover()).andReturn(new ImageWithSuffix("utf-8")).anyTimes(); |
||||||
|
EasyMock.replay(provider); |
||||||
|
|
||||||
|
ShareWidgetButton.ShareWidgetUI ui = new ShareWidgetButton.ShareWidgetUI(); |
||||||
|
|
||||||
|
ChartEditor editor = new ChartEditor(); |
||||||
|
Reflect.on(editor).set("chartCollection", new ChartCollection()); |
||||||
|
XCreator xCreator = ui.createXCreator(editor, "333", provider); |
||||||
|
Assert.assertEquals(300, xCreator.getWidth()); |
||||||
|
Assert.assertEquals(400, xCreator.getHeight()); |
||||||
|
} |
||||||
|
} |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue