kerry 8 years ago
parent
commit
e0ef93351d
  1. 31
      designer_chart/src/com/fr/design/mainframe/chart/gui/data/TableDataPane.java
  2. 34
      designer_form/src/com/fr/design/mainframe/FormSelectionUtils.java

31
designer_chart/src/com/fr/design/mainframe/chart/gui/data/TableDataPane.java

@ -25,6 +25,10 @@ public class TableDataPane extends FurtherBasicBeanPane<ChartCollection>{
private ChartDataPane parent; private ChartDataPane parent;
protected AbstractTableDataContentPane getDataContentPane() {
return dataContentPane;
}
public TableDataPane(ChartDataPane parent) { public TableDataPane(ChartDataPane parent) {
this.parent = parent; this.parent = parent;
initDataPane(); initDataPane();
@ -103,34 +107,41 @@ public class TableDataPane extends FurtherBasicBeanPane<ChartCollection>{
* @param collection 图表属性的集合 * @param collection 图表属性的集合
*/ */
public void refreshContentPane(ChartCollection collection) { public void refreshContentPane(ChartCollection collection) {
refreshContentPane(getContentPane(collection.getSelectedChart().getPlot()));
}
protected void refreshContentPane(AbstractTableDataContentPane contentPane) {
if(dataContentPane != null) { if(dataContentPane != null) {
remove(dataContentPane); remove(dataContentPane);
} }
dataContentPane = getContentPane(collection.getSelectedChart().getPlot()); dataContentPane = contentPane;
if(dataContentPane != null) { if(dataContentPane != null) {
add(dataContentPane, BorderLayout.CENTER); add(dataContentPane, BorderLayout.CENTER);
} }
} }
/** /**
* 更新界面属性 * 更新界面属性
*/ */
public void populateBean(ChartCollection collection) { public void populateBean(ChartCollection collection) {
if(collection == null) { if(collection == null) {
return; return;
} }
TableDataDefinition data = (TableDataDefinition)collection.getSelectedChart().getFilterDefinition(); TableDataDefinition data = (TableDataDefinition)collection.getSelectedChart().getFilterDefinition();
populateDSName(data);
if(dataContentPane != null) {
dataContentPane.populateBean(collection);
}
}
protected void populateDSName(TableDataDefinition dataDefinition){
TableData tableData = null; TableData tableData = null;
if(data != null) { if(dataDefinition != null) {
tableData = data.getTableData(); tableData = dataDefinition.getTableData();
} }
onSelectTableData(); onSelectTableData();
checkBoxUse(); checkBoxUse();
tableDataPane.populateBean(tableData); tableDataPane.populateBean(tableData);
if(dataContentPane != null) {
dataContentPane.populateBean(collection);
}
} }
/** /**
@ -141,6 +152,10 @@ public class TableDataPane extends FurtherBasicBeanPane<ChartCollection>{
dataContentPane.updateBean(collection); dataContentPane.updateBean(collection);
} }
TopDefinition dataDefinition = (TopDefinition)collection.getSelectedChart().getFilterDefinition(); TopDefinition dataDefinition = (TopDefinition)collection.getSelectedChart().getFilterDefinition();
updateDSName(dataDefinition);
}
protected void updateDSName(TopDefinition dataDefinition) {
if(dataDefinition instanceof TableDataDefinition) { if(dataDefinition instanceof TableDataDefinition) {
TableDataWrapper tableDataWrapper = tableDataPane.getTableDataWrapper(); TableDataWrapper tableDataWrapper = tableDataPane.getTableDataWrapper();
if (dataDefinition != null && tableDataWrapper != null){ if (dataDefinition != null && tableDataWrapper != null){

34
designer_form/src/com/fr/design/mainframe/FormSelectionUtils.java

@ -25,6 +25,7 @@ public class FormSelectionUtils {
//组件重命名后缀 //组件重命名后缀
private static final String POSTFIX = "_c"; private static final String POSTFIX = "_c";
private FormSelectionUtils() { private FormSelectionUtils() {
} }
@ -132,29 +133,18 @@ public class FormSelectionUtils {
XLayoutContainer container = layoutAdapter.getContainer(); XLayoutContainer container = layoutAdapter.getContainer();
boolean xOut = x < 0 || x + copiedCreator.getWidth() / 2 + xoffset > container.getWidth(); boolean xOut = x < 0 || x + copiedCreator.getWidth() / 2 + xoffset > container.getWidth();
boolean yOut = y < 0 || y + copiedCreator.getHeight() / 2 + yoffset > container.getHeight(); boolean yOut = y < 0 || y + copiedCreator.getHeight() / 2 + yoffset > container.getHeight();
/*
* 组件原始位置位于布局的右下角 y = yOut ? container.getHeight() - copiedCreator.getHeight() / 2 - yoffset : y;
* 和布局右下边界线紧挨 boolean isEdge = (x - DELAY_X_Y == container.getWidth() - copiedCreator.getWidth() / 2 - xoffset);
* 粘贴时组件在原始位置向左错开20像素 if (xOut) {
* x,y同时越界 if (isEdge) {
*/ //向左偏移
if (xOut && yOut) { x = container.getWidth() - copiedCreator.getWidth() / 2 - DELAY_X_Y - xoffset;
//向左偏移 }
x = container.getWidth() - copiedCreator.getWidth() / 2 - DELAY_X_Y - xoffset;
//紧贴下边界 //紧贴下边界
y = container.getHeight() - copiedCreator.getHeight() / 2 - yoffset; else {
return new Point(x, y); x = container.getWidth() - copiedCreator.getWidth() / 2 - xoffset;
} }
/*
* 组件原始位置与布局边界距离小于20像素下边界&右边界同时小于或者任意一个边界小于
* 则粘贴时距离小于20像素一侧直接贴近布局边界
* 距离大于20像素的一侧正常错开
* x,y中只有一个越界
*/
if ((xOut || yOut)) {
x = xOut ? container.getWidth() - copiedCreator.getWidth() / 2 - xoffset : x;
y = yOut ? container.getHeight() - copiedCreator.getHeight() / 2 - yoffset : y;
return new Point(x, y);
} }
} }
return new Point(x, y); return new Point(x, y);

Loading…
Cancel
Save