Browse Source

Merge pull request #1438 in DESIGN/design from ~BJORN/design:release/10.0 to release/10.0

* commit '96854b618530042e1b8ca9dbd9c12d608d25bb0e':
  CHART-12814 悬浮图表去掉clone
  CHART-12814 悬浮图表数据问题
feature/big-screen
Bjorn 5 years ago
parent
commit
86b6f4d7dc
  1. 69
      designer-realize/src/main/java/com/fr/design/actions/insert/flot/ChartFloatAction.java

69
designer-realize/src/main/java/com/fr/design/actions/insert/flot/ChartFloatAction.java

@ -17,7 +17,6 @@ import com.fr.design.menu.MenuKeySet;
import com.fr.design.module.DesignModuleFactory; import com.fr.design.module.DesignModuleFactory;
import com.fr.grid.Grid; import com.fr.grid.Grid;
import com.fr.grid.selection.FloatSelection; import com.fr.grid.selection.FloatSelection;
import com.fr.log.FineLoggerFactory;
import com.fr.report.ReportHelper; import com.fr.report.ReportHelper;
import com.fr.report.cell.FloatElement; import com.fr.report.cell.FloatElement;
import com.fr.report.elementcase.TemplateElementCase; import com.fr.report.elementcase.TemplateElementCase;
@ -86,43 +85,39 @@ public class ChartFloatAction extends ElementCaseAction {
public void doOk() { public void doOk() {
isRecordNeeded = true; isRecordNeeded = true;
FloatElement newFloatElement; FloatElement newFloatElement;
try { newFloatElement = new FloatElement(chartDialog.getChartCollection());
newFloatElement = new FloatElement(chartDialog.getChartCollection().clone()); newFloatElement.setWidth(new OLDPIX(BaseChartCollection.CHART_DEFAULT_WIDTH));
newFloatElement.setWidth(new OLDPIX(BaseChartCollection.CHART_DEFAULT_WIDTH)); newFloatElement.setHeight(new OLDPIX(BaseChartCollection.CHART_DEFAULT_HEIGHT));
newFloatElement.setHeight(new OLDPIX(BaseChartCollection.CHART_DEFAULT_HEIGHT));
Grid grid = reportPane.getGrid();
Grid grid = reportPane.getGrid(); TemplateElementCase report = reportPane.getEditingElementCase();
TemplateElementCase report = reportPane.getEditingElementCase(); DynamicUnitList columnWidthList = ReportHelper.getColumnWidthList(report);
DynamicUnitList columnWidthList = ReportHelper.getColumnWidthList(report); DynamicUnitList rowHeightList = ReportHelper.getRowHeightList(report);
DynamicUnitList rowHeightList = ReportHelper.getRowHeightList(report); int horizentalScrollValue = grid.getHorizontalValue();
int horizentalScrollValue = grid.getHorizontalValue(); int verticalScrollValue = grid.getVerticalValue();
int verticalScrollValue = grid.getVerticalValue();
int resolution = grid.getResolution();
int resolution = grid.getResolution(); int floatWdith = newFloatElement.getWidth().toPixI(resolution);
int floatWdith = newFloatElement.getWidth().toPixI(resolution); int floatHeight = newFloatElement.getWidth().toPixI(resolution);
int floatHeight = newFloatElement.getWidth().toPixI(resolution);
int leftDifference = (grid.getWidth() - floatWdith) > 0 ? (grid.getWidth() - floatWdith) : 0;
int leftDifference = (grid.getWidth() - floatWdith) > 0 ? (grid.getWidth() - floatWdith) : 0; int topDifference = (grid.getHeight() - floatHeight) > 0 ? (grid.getHeight() - floatHeight) : 0;
int topDifference = (grid.getHeight() - floatHeight) > 0 ? (grid.getHeight() - floatHeight) : 0; FU evtX_fu = FU.valueOfPix((leftDifference) / 2, resolution);
FU evtX_fu = FU.valueOfPix((leftDifference) / 2, resolution); FU evtY_fu = FU.valueOfPix((topDifference) / 2, resolution);
FU evtY_fu = FU.valueOfPix((topDifference) / 2, resolution);
FU leftDistance = FU.getInstance(evtX_fu.toFU() + columnWidthList.getRangeValue(0, horizentalScrollValue).toFU());
FU leftDistance = FU.getInstance(evtX_fu.toFU() + columnWidthList.getRangeValue(0, horizentalScrollValue).toFU()); FU topDistance = FU.getInstance(evtY_fu.toFU() + rowHeightList.getRangeValue(0, verticalScrollValue).toFU());
FU topDistance = FU.getInstance(evtY_fu.toFU() + rowHeightList.getRangeValue(0, verticalScrollValue).toFU());
newFloatElement.setLeftDistance(leftDistance);
newFloatElement.setLeftDistance(leftDistance); newFloatElement.setTopDistance(topDistance);
newFloatElement.setTopDistance(topDistance);
Style style = newFloatElement.getStyle();
Style style = newFloatElement.getStyle(); if (style != null) {
if (style != null) { newFloatElement.setStyle(style.deriveBorder(Constants.LINE_NONE, Color.black, Constants.LINE_NONE, Color.black, Constants.LINE_NONE, Color.black, Constants.LINE_NONE, Color.black));
newFloatElement.setStyle(style.deriveBorder(Constants.LINE_NONE, Color.black, Constants.LINE_NONE, Color.black, Constants.LINE_NONE, Color.black, Constants.LINE_NONE, Color.black));
}
reportPane.getEditingElementCase().addFloatElement(newFloatElement);
reportPane.setSelection(new FloatSelection(newFloatElement.getName()));
reportPane.fireSelectionChangeListener();
} catch (CloneNotSupportedException e) {
FineLoggerFactory.getLogger().error("Error in Float");
} }
reportPane.getEditingElementCase().addFloatElement(newFloatElement);
reportPane.setSelection(new FloatSelection(newFloatElement.getName()));
reportPane.fireSelectionChangeListener();
} }
}); });

Loading…
Cancel
Save