Browse Source

resolve conflict

master
hzzz 7 years ago
parent
commit
40d291c914
  1. 114
      designer/src/com/fr/design/actions/edit/HyperlinkAction.java
  2. 15
      designer/src/com/fr/design/actions/insert/flot/AbstractShapeAction.java
  3. 124
      designer/src/com/fr/design/actions/insert/flot/ChartFloatAction.java
  4. 57
      designer/src/com/fr/design/actions/insert/flot/FormulaFloatAction.java
  5. 17
      designer/src/com/fr/design/actions/insert/flot/ImageFloatAction.java
  6. 43
      designer/src/com/fr/design/actions/insert/flot/TextBoxFloatAction.java
  7. 34
      designer/src/com/fr/design/mainframe/ElementCasePaneDelegate.java
  8. 99
      designer/src/com/fr/design/mainframe/ReportFloatPane.java
  9. 55
      designer/src/com/fr/grid/GridMouseAdapter.java
  10. 23
      designer/src/com/fr/grid/GridUtils.java
  11. 2
      designer/src/com/fr/grid/selection/CellSelection.java
  12. 2
      designer/src/com/fr/grid/selection/FloatSelection.java
  13. 258
      designer/src/com/fr/poly/creator/ECBlockEditor.java
  14. 2
      designer/src/com/fr/poly/creator/ECBlockPane.java
  15. 89
      designer/src/com/fr/quickeditor/floatquick/FloatImageQuickEditor.java
  16. 201
      designer/src/com/fr/quickeditor/floatquick/FloatStringQuickEditor.java
  17. 5
      designer_base/src/com/fr/design/gui/controlpane/UIControlPane.java
  18. 6
      designer_base/src/com/fr/design/locale/designer.properties
  19. 6
      designer_base/src/com/fr/design/locale/designer_en_US.properties
  20. 5
      designer_base/src/com/fr/design/locale/designer_ja_JP.properties
  21. 6
      designer_base/src/com/fr/design/locale/designer_ko_KR.properties
  22. 6
      designer_base/src/com/fr/design/locale/designer_zh_CN.properties
  23. 6
      designer_base/src/com/fr/design/locale/designer_zh_TW.properties
  24. 36
      designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java

114
designer/src/com/fr/design/actions/edit/HyperlinkAction.java

@ -1,114 +0,0 @@
/*
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved.
*/
package com.fr.design.actions.edit;
import java.awt.Color;
import javax.swing.SwingUtilities;
import com.fr.base.BaseUtils;
import com.fr.base.Style;
import com.fr.design.actions.ElementCaseAction;
import com.fr.design.actions.utils.ReportActionUtils;
import com.fr.design.actions.utils.ReportActionUtils.IterAction;
import com.fr.design.gui.frpane.HyperlinkGroupPane;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.mainframe.HyperlinkGroupPaneActionImpl;
import com.fr.design.menu.KeySetUtils;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.general.FRFont;
import com.fr.grid.selection.CellSelection;
import com.fr.grid.selection.FloatSelection;
import com.fr.grid.selection.Selection;
import com.fr.js.NameJavaScriptGroup;
import com.fr.report.cell.CellElement;
import com.fr.report.cell.FloatElement;
import com.fr.report.elementcase.TemplateElementCase;
import com.fr.stable.Constants;
/**
* HyperlinkAction.
*/
public class HyperlinkAction extends ElementCaseAction {
private boolean b;
public HyperlinkAction(ElementCasePane t) {
super(t);
this.setMenuKeySet(KeySetUtils.HYPER_LINK);
this.setName(getMenuKeySet().getMenuKeySetName() + "...");
this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_insert/hyperLink.png"));
}
/**
* 计算Action,
* @return 返回是否需要记录undo
*/
public boolean executeActionReturnUndoRecordNeeded() {
b = true;
ElementCasePane reportPane = this.getEditingComponent();
if (reportPane == null) {
return false;
}
final TemplateElementCase report = reportPane.getEditingElementCase();
NameJavaScriptGroup nameHyperlinks = getNameJSGroup(reportPane, report);
final HyperlinkGroupPane pane = DesignerContext.getDesignerFrame().getSelectedJTemplate().getHyperLinkPane(HyperlinkGroupPaneActionImpl.getInstance());
pane.populate(nameHyperlinks);
final Selection sel = reportPane.getSelection();
BasicDialog dialog = pane.showWindow(SwingUtilities.getWindowAncestor(reportPane));
dialog.addDialogActionListener(new DialogActionAdapter() {
public void doOk() {
super.doOk();
final NameJavaScriptGroup updateNameHyperlinks = pane.updateJSGroup();
if (sel instanceof FloatSelection) {
FloatElement selectedFloatElement = report.getFloatElement(((FloatSelection)sel).getSelectedFloatName());
selectedFloatElement.setNameHyperlinkGroup(updateNameHyperlinks);
} else {
ReportActionUtils.actionIterateWithCellSelection((CellSelection)sel, report, new IterAction() {
public void dealWith(CellElement editCellElement) {
Style elementStyle = editCellElement.getStyle();
FRFont frFont = elementStyle.getFRFont();
if (updateNameHyperlinks.size() > 0) {
frFont = frFont.applyForeground(Color.blue);
frFont = frFont.applyUnderline(Constants.LINE_THIN);
} else {
frFont = frFont.applyForeground(Color.black);
frFont = frFont.applyUnderline(Constants.LINE_NONE);
}
editCellElement.setStyle(elementStyle.deriveFRFont(frFont));
editCellElement.setNameHyperlinkGroup(updateNameHyperlinks);
}
});
}
}
public void doCancel() {
b = false;
}
});
dialog.setVisible(true);
return b;
}
private NameJavaScriptGroup getNameJSGroup(ElementCasePane reportPane, final TemplateElementCase report) {
NameJavaScriptGroup nameHyperlinks = null;
final Selection sel = reportPane.getSelection();
if (sel instanceof FloatSelection) {
FloatElement selectedFloatElement = report.getFloatElement(((FloatSelection)sel).getSelectedFloatName());
nameHyperlinks = selectedFloatElement.getNameHyperlinkGroup();
} else {
CellElement editCellElement = report.getCellElement(((CellSelection)sel).getColumn(), ((CellSelection)sel).getRow());
if (editCellElement != null) {
nameHyperlinks = editCellElement.getNameHyperlinkGroup();
}
}
return nameHyperlinks;
}
}

15
designer/src/com/fr/design/actions/insert/flot/AbstractShapeAction.java

@ -4,6 +4,7 @@
package com.fr.design.actions.insert.flot;
import com.fr.design.actions.ElementCaseAction;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.mainframe.ElementCasePane;
import com.fr.report.cell.FloatElement;
@ -11,20 +12,20 @@ import com.fr.report.cell.FloatElement;
* Abstract shape.
*/
public abstract class AbstractShapeAction extends ElementCaseAction {
protected AbstractShapeAction(ElementCasePane t) {
super(t);
}
protected AbstractShapeAction(ElementCasePane t) {
super(t);
}
public void startDraw(FloatElement floatElement) {
ElementCasePane jws = getEditingComponent();
ElementCasePane jws = (ElementCasePane) HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getCurrentElementCasePane();
if (jws == null) {
return;
}
jws.getGrid().setDrawingFloatElement(floatElement);
}
@Override
public boolean executeActionReturnUndoRecordNeeded() {
return false;
return false;
}
}

124
designer/src/com/fr/design/actions/insert/flot/ChartFloatAction.java

@ -8,6 +8,7 @@ import com.fr.base.Style;
import com.fr.base.chart.BaseChartCollection;
import com.fr.design.actions.ElementCaseAction;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.gui.chart.MiddleChartDialog;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.ElementCasePane;
@ -32,77 +33,78 @@ public class ChartFloatAction extends ElementCaseAction {
/**
* 构造函数 图表插入悬浮元素
*/
public ChartFloatAction(ElementCasePane t) {
super(t);
public ChartFloatAction(ElementCasePane t) {
super(t);
this.setMenuKeySet(FLOAT_INSERT_CHART);
this.setName(getMenuKeySet().getMenuKeySetName()+ "...");
this.setName(getMenuKeySet().getMenuKeySetName() + "...");
this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_insert/chart.png"));
}
public static final MenuKeySet FLOAT_INSERT_CHART = new MenuKeySet() {
@Override
public char getMnemonic() {
return 'C';
}
public static final MenuKeySet FLOAT_INSERT_CHART = new MenuKeySet() {
@Override
public char getMnemonic() {
return 'C';
}
@Override
public String getMenuName() {
return Inter.getLocText("M_Insert-Chart");
}
@Override
public String getMenuName() {
return Inter.getLocText("FR-Designer_Insert_Chart");
}
@Override
public KeyStroke getKeyStroke() {
return null;
}
};
@Override
public KeyStroke getKeyStroke() {
return null;
}
};
/**
* 执行插入悬浮元素操作, 并返回true, 需要记录撤销.
*
* @return 是则返回true
*/
public boolean executeActionReturnUndoRecordNeeded() {
final ElementCasePane reportPane = getEditingComponent();
if (reportPane == null) {
return false;
}
reportPane.stopEditing();
final BaseChartCollection cc = (BaseChartCollection)StableFactory.createXmlObject(BaseChartCollection.XML_TAG);
cc.removeAllNameObject();
final MiddleChartDialog chartDialog = DesignModuleFactory.getChartDialog(DesignerContext.getDesignerFrame());
chartDialog.populate(cc);
chartDialog.addDialogActionListener(new DialogActionAdapter() {
@Override
public void doOk() {
FloatElement newFloatElement;
try {
newFloatElement = new FloatElement(chartDialog.getChartCollection().clone());
newFloatElement.setLeftDistance(new OLDPIX(20));
newFloatElement.setTopDistance(new OLDPIX(20));
newFloatElement.setWidth(new OLDPIX(BaseChartCollection.CHART_DEFAULT_WIDTH));
newFloatElement.setHeight(new OLDPIX(BaseChartCollection.CHART_DEFAULT_HEIGHT));
Style style = newFloatElement.getStyle();
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));
}
reportPane.getEditingElementCase().addFloatElement(newFloatElement);
reportPane.setSelection(new FloatSelection(newFloatElement.getName()));
reportPane.fireTargetModified();
reportPane.fireSelectionChangeListener();
} catch (CloneNotSupportedException e) {
FRLogger.getLogger().error("Error in Float");
}
}
});
chartDialog.setVisible(true);
return true;
}
public boolean executeActionReturnUndoRecordNeeded() {
final ElementCasePane reportPane = (ElementCasePane) HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getCurrentElementCasePane();
if (reportPane == null) {
return false;
}
reportPane.stopEditing();
final BaseChartCollection cc = (BaseChartCollection) StableFactory.createXmlObject(BaseChartCollection.XML_TAG);
cc.removeAllNameObject();
final MiddleChartDialog chartDialog = DesignModuleFactory.getChartDialog(DesignerContext.getDesignerFrame());
chartDialog.populate(cc);
chartDialog.addDialogActionListener(new DialogActionAdapter() {
@Override
public void doOk() {
FloatElement newFloatElement;
try {
newFloatElement = new FloatElement(chartDialog.getChartCollection().clone());
newFloatElement.setLeftDistance(new OLDPIX(20));
newFloatElement.setTopDistance(new OLDPIX(20));
newFloatElement.setWidth(new OLDPIX(BaseChartCollection.CHART_DEFAULT_WIDTH));
newFloatElement.setHeight(new OLDPIX(BaseChartCollection.CHART_DEFAULT_HEIGHT));
Style style = newFloatElement.getStyle();
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));
}
reportPane.getEditingElementCase().addFloatElement(newFloatElement);
reportPane.setSelection(new FloatSelection(newFloatElement.getName()));
reportPane.fireTargetModified();
reportPane.fireSelectionChangeListener();
} catch (CloneNotSupportedException e) {
FRLogger.getLogger().error("Error in Float");
}
}
});
chartDialog.setVisible(true);
return true;
}
}

57
designer/src/com/fr/design/actions/insert/flot/FormulaFloatAction.java

@ -4,11 +4,18 @@
package com.fr.design.actions.insert.flot;
import com.fr.base.BaseUtils;
import com.fr.base.DynamicUnitList;
import com.fr.base.Formula;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.menu.MenuKeySet;
import com.fr.general.Inter;
import com.fr.grid.Grid;
import com.fr.grid.selection.FloatSelection;
import com.fr.report.ReportHelper;
import com.fr.report.cell.FloatElement;
import com.fr.report.elementcase.TemplateElementCase;
import com.fr.stable.unit.FU;
import javax.swing.*;
import java.awt.event.ActionEvent;
@ -17,10 +24,10 @@ import java.awt.event.ActionEvent;
* Insert formula.
*/
public class FormulaFloatAction extends AbstractShapeAction {
public FormulaFloatAction(ElementCasePane t) {
super(t);
public FormulaFloatAction(ElementCasePane t) {
super(t);
this.setMenuKeySet(FLOAT_INSERT_FORMULA);
this.setName(getMenuKeySet().getMenuKeySetName()+ "...");
this.setName(getMenuKeySet().getMenuKeySetName() + "...");
this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_insert/formula.png"));
}
@ -33,7 +40,7 @@ public class FormulaFloatAction extends AbstractShapeAction {
@Override
public String getMenuName() {
return Inter.getLocText("HF-Insert_Formula");
return Inter.getLocText("FR-Designer_Insert_Formula");
}
@Override
@ -44,16 +51,48 @@ public class FormulaFloatAction extends AbstractShapeAction {
/**
* 动作
*
* @param e 事件
*/
public void actionPerformed(ActionEvent e) {
ElementCasePane jws = getEditingComponent();
public void actionPerformed(ActionEvent e) {
ElementCasePane jws = getEditingComponent();
if (jws == null) {
return;
}
//
FloatElement floatElement = new FloatElement( new Formula(""));
//
FloatElement floatElement = new FloatElement(new Formula(""));
this.startDraw(floatElement);
doWithDrawingFloatElement();
jws.getGrid().startEditing();
}
private void doWithDrawingFloatElement() {
ElementCasePane jws = (ElementCasePane) HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getCurrentElementCasePane();
Grid grid = jws.getGrid();
ElementCasePane reportPane = grid.getElementCasePane();
TemplateElementCase report = reportPane.getEditingElementCase();
DynamicUnitList columnWidthList = ReportHelper.getColumnWidthList(report);
DynamicUnitList rowHeightList = ReportHelper.getRowHeightList(report);
int horizentalScrollValue = grid.getHorizontalValue();
int verticalScrollValue = grid.getVerticalValue();
int resolution = grid.getResolution();
int floatWdith = grid.getDrawingFloatElement().getWidth().toPixI(resolution);
int floatHeight = grid.getDrawingFloatElement().getWidth().toPixI(resolution);
FU evtX_fu = FU.valueOfPix((grid.getWidth() - floatWdith) / 2, resolution);
FU evtY_fu = FU.valueOfPix((grid.getHeight() - floatHeight) / 2, resolution);
FU leftDistance = FU.getInstance(evtX_fu.toFU() + columnWidthList.getRangeValue(0, horizentalScrollValue).toFU());
FU topDistance = FU.getInstance(evtY_fu.toFU() + rowHeightList.getRangeValue(0, verticalScrollValue).toFU());
grid.getDrawingFloatElement().setLeftDistance(leftDistance);
grid.getDrawingFloatElement().setTopDistance(topDistance);
report.addFloatElement(grid.getDrawingFloatElement());
reportPane.setSelection(new FloatSelection(grid.getDrawingFloatElement().getName()));
}
}

17
designer/src/com/fr/design/actions/insert/flot/ImageFloatAction.java

@ -8,6 +8,7 @@ import com.fr.base.ScreenResolution;
import com.fr.design.actions.ElementCaseAction;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.menu.MenuKeySet;
@ -28,12 +29,12 @@ import java.io.File;
*/
public class ImageFloatAction extends ElementCaseAction {
private boolean returnValue = false;
private boolean returnValue = false;
public ImageFloatAction(ElementCasePane t) {
super(t);
super(t);
this.setMenuKeySet(FLOAT_INSERT_IMAGE);
this.setName(getMenuKeySet().getMenuKeySetName()+ "...");
this.setName(getMenuKeySet().getMenuKeySetName() + "...");
this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_insert/image.png"));
}
@ -46,7 +47,7 @@ public class ImageFloatAction extends ElementCaseAction {
@Override
public String getMenuName() {
return Inter.getLocText("HF-Insert_Image");
return Inter.getLocText("FR-Designer_Insert_Image");
}
@Override
@ -57,10 +58,11 @@ public class ImageFloatAction extends ElementCaseAction {
/**
* 执行动作
*
* @return 成功返回true
*/
public boolean executeActionReturnUndoRecordNeeded() {
final ElementCasePane reportPane = getEditingComponent();
final ElementCasePane reportPane = (ElementCasePane) HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getCurrentElementCasePane();
if (reportPane == null) {
return false;
}
@ -96,9 +98,10 @@ public class ImageFloatAction extends ElementCaseAction {
returnValue = true;
}
}
@Override
public void doCancel() {
returnValue = false;
public void doCancel() {
returnValue = false;
}
});
dialog.setVisible(true);

43
designer/src/com/fr/design/actions/insert/flot/TextBoxFloatAction.java

@ -4,10 +4,17 @@
package com.fr.design.actions.insert.flot;
import com.fr.base.BaseUtils;
import com.fr.base.DynamicUnitList;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.menu.MenuKeySet;
import com.fr.general.Inter;
import com.fr.grid.Grid;
import com.fr.grid.selection.FloatSelection;
import com.fr.report.ReportHelper;
import com.fr.report.cell.FloatElement;
import com.fr.report.elementcase.TemplateElementCase;
import com.fr.stable.unit.FU;
import javax.swing.*;
import java.awt.event.ActionEvent;
@ -15,7 +22,7 @@ import java.awt.event.ActionEvent;
/**
* Insert textbox.
*/
public class TextBoxFloatAction extends AbstractShapeAction {
public class TextBoxFloatAction extends AbstractShapeAction {
public TextBoxFloatAction(ElementCasePane t) {
super(t);
this.setMenuKeySet(FLOAT_INSERT_TEXT);
@ -32,7 +39,7 @@ public class TextBoxFloatAction extends AbstractShapeAction {
@Override
public String getMenuName() {
return Inter.getLocText("M_Insert-Text");
return Inter.getLocText("FR-Designer_Insert_Text");
}
@Override
@ -54,5 +61,37 @@ public class TextBoxFloatAction extends AbstractShapeAction {
}
FloatElement floatElement = new FloatElement("Text");
this.startDraw(floatElement);
doWithDrawingFloatElement();
}
private void doWithDrawingFloatElement() {
ElementCasePane jws = (ElementCasePane) HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getCurrentElementCasePane();
;
Grid grid = jws.getGrid();
ElementCasePane reportPane = grid.getElementCasePane();
TemplateElementCase report = reportPane.getEditingElementCase();
DynamicUnitList columnWidthList = ReportHelper.getColumnWidthList(report);
DynamicUnitList rowHeightList = ReportHelper.getRowHeightList(report);
int horizentalScrollValue = grid.getHorizontalValue();
int verticalScrollValue = grid.getVerticalValue();
int resolution = grid.getResolution();
int floatWdith = grid.getDrawingFloatElement().getWidth().toPixI(resolution);
int floatHeight = grid.getDrawingFloatElement().getWidth().toPixI(resolution);
FU evtX_fu = FU.valueOfPix((grid.getWidth() - floatWdith) / 2, resolution);
FU evtY_fu = FU.valueOfPix((grid.getHeight() - floatHeight) / 2, resolution);
FU leftDistance = FU.getInstance(evtX_fu.toFU() + columnWidthList.getRangeValue(0, horizentalScrollValue).toFU());
FU topDistance = FU.getInstance(evtY_fu.toFU() + rowHeightList.getRangeValue(0, verticalScrollValue).toFU());
grid.getDrawingFloatElement().setLeftDistance(leftDistance);
grid.getDrawingFloatElement().setTopDistance(topDistance);
report.addFloatElement(grid.getDrawingFloatElement());
reportPane.setSelection(new FloatSelection(grid.getDrawingFloatElement().getName()));
}
}

34
designer/src/com/fr/design/mainframe/ElementCasePaneDelegate.java

@ -1,35 +1,35 @@
package com.fr.design.mainframe;
import com.fr.base.BaseUtils;
import com.fr.design.fun.MenuHandler;
import com.fr.design.gui.frpane.HyperlinkGroupPane;
import com.fr.design.menu.KeySetUtils;
import com.fr.general.Inter;
import com.fr.grid.selection.FloatSelection;
import com.fr.page.ReportSettingsProvider;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.DesignState;
import com.fr.design.roleAuthority.RolesAlreadyEditedPane;
import com.fr.design.actions.UpdateAction;
import com.fr.design.actions.cell.*;
import com.fr.design.actions.columnrow.InsertColumnAction;
import com.fr.design.actions.columnrow.InsertRowAction;
import com.fr.design.actions.core.ActionFactory;
import com.fr.design.actions.edit.HyperlinkAction;
import com.fr.design.actions.edit.merge.MergeCellAction;
import com.fr.design.actions.edit.merge.UnmergeCellAction;
import com.fr.design.actions.columnrow.InsertColumnAction;
import com.fr.design.actions.columnrow.InsertRowAction;
import com.fr.design.actions.utils.DeprecatedActionManager;
import com.fr.design.event.TargetModifiedEvent;
import com.fr.design.event.TargetModifiedListener;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.fun.MenuHandler;
import com.fr.design.gui.frpane.HyperlinkGroupPane;
import com.fr.design.mainframe.cell.QuickEditorRegion;
import com.fr.design.menu.KeySetUtils;
import com.fr.design.menu.MenuDef;
import com.fr.design.menu.SeparatorDef;
import com.fr.report.worksheet.WorkSheet;
import com.fr.design.roleAuthority.RolesAlreadyEditedPane;
import com.fr.design.selection.SelectionEvent;
import com.fr.design.selection.SelectionListener;
import com.fr.general.Inter;
import com.fr.grid.selection.FloatSelection;
import com.fr.page.ReportSettingsProvider;
import com.fr.report.worksheet.WorkSheet;
import com.fr.stable.ArrayUtils;
import javax.swing.*;
import java.awt.*;
/**
* 类说明: 设计面板中最上方的"插入" "单元格"下拉列表Menu模块.
@ -63,11 +63,14 @@ public class ElementCasePaneDelegate extends ElementCasePane<WorkSheet> {
// HyperlinkGroupPane hyperlinkGroupPane = ReportHyperlinkGroupPane.getInstance(HyperlinkGroupPaneActionImpl.getInstance());
HyperlinkGroupPane hyperlinkGroupPane = editingTemplate.getHyperLinkPane(HyperlinkGroupPaneActionImpl.getInstance());
hyperlinkGroupPane.populate(ElementCasePaneDelegate.this);
if (((ElementCasePaneDelegate)e.getSource()).getSelection() instanceof FloatSelection) {
if (((ElementCasePaneDelegate) e.getSource()).getSelection() instanceof FloatSelection) {
EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.REPORT_FLOAT);
// EastRegionContainerPane.getInstance().replaceCellAttrPane(CellElementPropertyPane.getInstance());
EastRegionContainerPane.getInstance().replaceFloatElementPane(QuickEditorRegion.getInstance());
JPanel floatPane = new JPanel(new BorderLayout());
floatPane.add(ReportFloatPane.getInstance(), BorderLayout.NORTH);
floatPane.add(QuickEditorRegion.getInstance(), BorderLayout.CENTER);
EastRegionContainerPane.getInstance().replaceFloatElementPane(floatPane);
} else {
EastRegionContainerPane.getInstance().replaceFloatElementPane(ReportFloatPane.getInstance());
EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.REPORT);
EastRegionContainerPane.getInstance().replaceCellAttrPane(CellElementPropertyPane.getInstance());
EastRegionContainerPane.getInstance().replaceCellElementPane(QuickEditorRegion.getInstance());
@ -165,7 +168,6 @@ public class ElementCasePaneDelegate extends ElementCasePane<WorkSheet> {
// 单元格形态
menuDef.addShortCut(DeprecatedActionManager.getPresentMenu(this));
menuDef.addShortCut(new HyperlinkAction(this));
menuDef.addShortCut(SeparatorDef.DEFAULT);
menuDef.addShortCut(new MergeCellAction(this));
menuDef.addShortCut(new UnmergeCellAction(this));

99
designer/src/com/fr/design/mainframe/ReportFloatPane.java

@ -0,0 +1,99 @@
package com.fr.design.mainframe;
import com.fr.design.actions.UpdateAction;
import com.fr.design.actions.core.ActionFactory;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itoolbar.UIToolbar;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.menu.KeySetUtils;
import com.fr.design.menu.MenuDef;
import com.fr.general.Inter;
import javax.swing.*;
import java.awt.*;
/**
* 悬浮元素
* Created by MoMeak on 2017/7/27.
*/
public class ReportFloatPane extends JPanel {
private static ReportFloatPane THIS;
private ElementCasePaneDelegate elementCasePaneDelegate;
private MenuDef insertFloatMenu;
private ReportFloatPane() {
initComponent();
}
public synchronized static final ReportFloatPane getInstance() {
if (THIS == null) {
THIS = new ReportFloatPane();
}
return THIS;
}
private void initComponent() {
this.setLayout(new BorderLayout());
UIToolbar topToolBar = new UIToolbar();
topToolBar.setLayout(new BorderLayout());
insertFloatMenu = createInsertToolBar();
topToolBar.add(createButtonUI());
topToolBar.setBorder(BorderFactory.createEmptyBorder(2, 10, 2, 0));
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] columnSize = {p, f};
double[] rowSize = {p};
Component[][] components = new Component[][]{
new Component[]{new UILabel(" " + Inter.getLocText("FR-Designer_Add_FloatElement")), topToolBar},
};
JPanel leftTopPane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
leftTopPane.setBorder(BorderFactory.createEmptyBorder(0, 4, 0, 10));
this.add(leftTopPane, BorderLayout.NORTH);
}
private MenuDef createInsertToolBar() {
MenuDef insertFloatMenu = new MenuDef();
insertFloatMenu.setName(KeySetUtils.INSERT_FLOAT.getMenuKeySetName());
insertFloatMenu.setTooltip(Inter.getLocText("FR-Designer_T_Insert_Float"));
insertFloatMenu.setIconPath("com/fr/design/images/control/addPopup.png");
JTemplate editingTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
elementCasePaneDelegate = (ElementCasePaneDelegate) editingTemplate.getCurrentElementCasePane();
UpdateAction[] actions = ActionFactory.createFloatInsertAction(ElementCasePane.class, elementCasePaneDelegate);
for (int i = 0; i < actions.length; i++) {
insertFloatMenu.addShortCut(actions[i]);
}
return insertFloatMenu;
}
private UIButton createButtonUI() {
UIButton createdButton = insertFloatMenu.createUIButton();
// 此按钮单独抽出,不应使用工具栏外观
if (!createdButton.isOpaque()) {
createdButton.setOpaque(true);
createdButton.setNormalPainted(true);
createdButton.setBorderPaintedOnlyWhenPressed(false);
}
return createdButton;
}
public static void main(String[] args) {
// JFrame jf = new JFrame("test");
// jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
// JPanel content = (JPanel) jf.getContentPane();
// content.setLayout(new BorderLayout());
// content.add(ReportFloatPane.getInstance(), BorderLayout.CENTER);
// GUICoreUtils.centerWindow(jf);
// jf.setSize(250, 400);
// jf.setVisible(true);
}
}

55
designer/src/com/fr/grid/GridMouseAdapter.java

@ -25,7 +25,6 @@ import com.fr.stable.ArrayUtils;
import com.fr.stable.ColumnRow;
import com.fr.stable.StringUtils;
import com.fr.stable.unit.FU;
import com.fr.stable.unit.OLDPIX;
import javax.swing.*;
import java.awt.*;
@ -72,7 +71,7 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous
private int ECBlockGap = 40;
private int resolution = (int) (ScreenResolution.getScreenResolution()* JSliderPane.getInstance().resolutionTimes);
private int resolution = (int) (ScreenResolution.getScreenResolution() * JSliderPane.getInstance().resolutionTimes);
protected GridMouseAdapter(Grid grid) {
this.grid = grid;
@ -93,19 +92,15 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous
grid.requestFocus();
}
if (grid.getDrawingFloatElement() != null) {
doWithDrawingFloatElement();
if (SwingUtilities.isRightMouseButton(evt)) {
doWithRightButtonPressed();
} else {
if (SwingUtilities.isRightMouseButton(evt)) {
doWithRightButtonPressed();
} else {
doWithLeftButtonPressed(evt);
}
// 用户没有按住Shift键时,tempOldSelectedCell是一直变化的。如果一直按住shift,是不变的
ElementCasePane ePane = grid.getElementCasePane();
if (!evt.isShiftDown() && ePane.getSelection() instanceof CellSelection) {
tempOldSelectedCell = GridUtils.getAdjustEventColumnRow_withresolution(ePane, oldEvtX, oldEvtY,resolution);
}
doWithLeftButtonPressed(evt);
}
// 用户没有按住Shift键时,tempOldSelectedCell是一直变化的。如果一直按住shift,是不变的
ElementCasePane ePane = grid.getElementCasePane();
if (!evt.isShiftDown() && ePane.getSelection() instanceof CellSelection) {
tempOldSelectedCell = GridUtils.getAdjustEventColumnRow_withresolution(ePane, oldEvtX, oldEvtY, resolution);
}
}
@ -240,14 +235,9 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous
boolean isDataChanged = false;
ElementCasePane reportPane = grid.getElementCasePane();
Selection selection = reportPane.getSelection();
if (grid.getDrawingFloatElement() != null) {
if (grid.getDrawingFloatElement().getWidth().equal_zero() && grid.getDrawingFloatElement().getHeight().equal_zero()) {
grid.getDrawingFloatElement().setWidth(new OLDPIX(100));
grid.getDrawingFloatElement().setHeight(new OLDPIX(100));
}
grid.setDrawingFloatElement(null);
} else if (selection instanceof FloatSelection) {
grid.setCursor(Cursor.getDefaultCursor());
if (selection instanceof FloatSelection) {
grid.setCursor(new Cursor(Cursor.MOVE_CURSOR));
}
if (grid.getDragType() == GridUtils.DRAG_CELLSELECTION) {
if (selection instanceof CellSelection) {
@ -586,16 +576,13 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous
*/
private void mouseMoveOnGrid(int evtX, int evtY) {
grid.setToolTipText(null);
if (grid.getDrawingFloatElement() != null) {
grid.setCursor(UIConstants.DRAW_CURSOR); // august:是否是将要画悬浮元素,就是那个笔的形状
} else {
Object[] floatElementCursor = GridUtils.getAboveFloatElementCursor(grid.getElementCasePane(), evtX, evtY);
if (!ArrayUtils.isEmpty(floatElementCursor)) {// 鼠标在悬浮元素上移动
grid.setCursor((Cursor) floatElementCursor[1]);
} else {// 鼠标在单元格上移动
doMouseMoveOnCells(evtX, evtY);
}
Object[] floatElementCursor = GridUtils.getAboveFloatElementCursor(grid.getElementCasePane(), evtX, evtY);
if (!ArrayUtils.isEmpty(floatElementCursor)) {// 鼠标在悬浮元素上移动
grid.setCursor((Cursor) floatElementCursor[1]);
} else {// 鼠标在单元格上移动
doMouseMoveOnCells(evtX, evtY);
}
}
/**
@ -765,8 +752,10 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous
FloatElement floatElement = (FloatElement) tmpFloatElementCursor[0];
String floatName = floatElement.getName();
reportPane.setSelection(new FloatSelection(floatName));
double[] floatArray = GridUtils.caculateFloatElementLocations(floatElement, ReportHelper.getColumnWidthList(report), ReportHelper.getRowHeightList(report), reportPane
.getGrid().getVerticalValue(), reportPane.getGrid().getHorizontalValue());
// double[] floatArray = GridUtils.caculateFloatElementLocations(floatElement, ReportHelper.getColumnWidthList(report), ReportHelper.getRowHeightList(report), reportPane
// .getGrid().getVerticalValue(), reportPane.getGrid().getHorizontalValue());
double[] floatArray = GridUtils.caculateFloatElementLocations_withresolution(floatElement, ReportHelper.getColumnWidthList(report), ReportHelper.getRowHeightList(report), reportPane
.getGrid().getVerticalValue(), reportPane.getGrid().getHorizontalValue(), grid.getResolution());
int cursorType = ((Cursor) tmpFloatElementCursor[1]).getType();
if (cursorType == Cursor.MOVE_CURSOR) {

23
designer/src/com/fr/grid/GridUtils.java

@ -65,12 +65,11 @@ public class GridUtils {
Iterator flotIt = report.floatIterator();
while (flotIt.hasNext()) {
FloatElement tmpFloatElement = (FloatElement) flotIt.next();
int resolution = reportPane.getGrid().getResolution();
//peter:计算悬浮元素的四个角落的位置.
double[] floatArray = caculateFloatElementLocations(tmpFloatElement, ReportHelper.getColumnWidthList(report),
ReportHelper.getRowHeightList(report), reportPane.getGrid().getVerticalValue(), reportPane.getGrid().getHorizontalValue());
double[] floatArray = caculateFloatElementLocations_withresolution(tmpFloatElement, ReportHelper.getColumnWidthList(report),
ReportHelper.getRowHeightList(report), reportPane.getGrid().getVerticalValue(), reportPane.getGrid().getHorizontalValue(), resolution);
// int resolution = ScreenResolution.getScreenResolution();
int resolution = (int) (ScreenResolution.getScreenResolution()* JSliderPane.getInstance().resolutionTimes);
//peter:悬浮元素的范围.
Rectangle2D floatElementRect = new Rectangle2D.Double(floatArray[0], floatArray[1], tmpFloatElement.getWidth().toPixD(resolution), tmpFloatElement.getHeight().toPixD(resolution));
//peter:不是当前选中的悬浮元素,不支持六个改变大小的点.
@ -127,7 +126,19 @@ public class GridUtils {
public static double[] caculateFloatElementLocations(FloatElement floatElement, DynamicUnitList columnWidthList, DynamicUnitList rowHeightList,
int verticalValue, int horizentalValue) {
// int resolution = ScreenResolution.getScreenResolution();
int resolution = (int) (ScreenResolution.getScreenResolution()* JSliderPane.getInstance().resolutionTimes);
int resolution = (int) (ScreenResolution.getScreenResolution() * JSliderPane.getInstance().resolutionTimes);
double floatX = columnWidthList.getRangeValue(horizentalValue, 0).toPixD(resolution) + floatElement.getLeftDistance().toPixD(resolution);
double floatY = rowHeightList.getRangeValue(verticalValue, 0).toPixD(resolution) + floatElement.getTopDistance().toPixD(resolution);
double floatX2 = floatX + floatElement.getWidth().toPixD(resolution);
double floatY2 = floatY + floatElement.getHeight().toPixD(resolution);
return new double[]{floatX, floatY, floatX2, floatY2};
}
public static double[] caculateFloatElementLocations_withresolution(FloatElement floatElement, DynamicUnitList columnWidthList, DynamicUnitList rowHeightList,
int verticalValue, int horizentalValue, int resolution) {
double floatX = columnWidthList.getRangeValue(horizentalValue, 0).toPixD(resolution) + floatElement.getLeftDistance().toPixD(resolution);
double floatY = rowHeightList.getRangeValue(verticalValue, 0).toPixD(resolution) + floatElement.getTopDistance().toPixD(resolution);
@ -170,7 +181,7 @@ public class GridUtils {
double tmpIntIndex = 0;
int selectedCellIndex = 0;
// int resolution = ScreenResolution.getScreenResolution();
int resolution = (int) (ScreenResolution.getScreenResolution()* JSliderPane.getInstance().resolutionTimes);
int resolution = (int) (ScreenResolution.getScreenResolution() * JSliderPane.getInstance().resolutionTimes);
if (mouseEvtPosition < 0) {
selectedCellIndex = value;
for (; true; selectedCellIndex--) {

2
designer/src/com/fr/grid/selection/CellSelection.java

@ -8,7 +8,6 @@ import com.fr.design.actions.cell.GlobalStyleMenuDef.GlobalStyleSelection;
import com.fr.design.actions.core.ActionFactory;
import com.fr.design.actions.edit.CopyAction;
import com.fr.design.actions.edit.CutAction;
import com.fr.design.actions.edit.HyperlinkAction;
import com.fr.design.actions.edit.PasteAction;
import com.fr.design.actions.utils.DeprecatedActionManager;
import com.fr.design.cell.clipboard.CellElementsClip;
@ -461,7 +460,6 @@ public class CellSelection extends Selection {
popup.add(DeprecatedActionManager.getPresentMenu(ePane).createJMenu());
popup.add(new ConditionAttributesAction(ePane).createMenuItem());
popup.add(new CellAttributeAction().createMenuItem());
popup.add(new HyperlinkAction(ePane).createMenuItem());
// cut, copy and paste
popup.addSeparator();
popup.add(new CutAction(ePane).createMenuItem());

2
designer/src/com/fr/grid/selection/FloatSelection.java

@ -13,7 +13,6 @@ import com.fr.design.actions.edit.CopyAction;
import com.fr.design.actions.edit.CutAction;
import com.fr.design.actions.edit.DeleteAction;
import com.fr.design.actions.edit.EditFloatElementNameAction;
import com.fr.design.actions.edit.HyperlinkAction;
import com.fr.design.actions.edit.PasteAction;
import com.fr.design.actions.utils.DeprecatedActionManager;
import com.fr.design.cell.clipboard.CellElementsClip;
@ -126,7 +125,6 @@ public class FloatSelection extends Selection {
}
popup.add(DeprecatedActionManager.getCellMenu(ePane).createJMenu());
popup.add(new FloatStyleAction(ePane).createMenuItem());
popup.add(new HyperlinkAction(ePane).createMenuItem());
// cut, copy and paste
popup.addSeparator();

258
designer/src/com/fr/poly/creator/ECBlockEditor.java

@ -3,8 +3,6 @@
*/
package com.fr.poly.creator;
import java.awt.Dimension;
import com.fr.base.BaseUtils;
import com.fr.base.ScreenResolution;
import com.fr.design.constants.UIConstants;
@ -15,6 +13,8 @@ import com.fr.design.gui.frpane.HyperlinkGroupPane;
import com.fr.design.mainframe.*;
import com.fr.design.mainframe.cell.QuickEditorRegion;
import com.fr.grid.GridUtils;
import com.fr.grid.selection.FloatSelection;
import com.fr.grid.selection.Selection;
import com.fr.poly.PolyConstants;
import com.fr.poly.PolyDesigner;
import com.fr.poly.PolyDesigner.SelectionType;
@ -24,131 +24,143 @@ import com.fr.report.poly.PolyECBlock;
import com.fr.stable.unit.UNITConstants;
import com.fr.stable.unit.UnitRectangle;
import javax.swing.*;
import java.awt.*;
/**
* @author richer
* @since 6.5.4 创建于2011-5-5 单元格类型的聚合块编辑器
*/
public class ECBlockEditor extends BlockEditor<ECBlockPane, PolyECBlock> {
private static final int HEIGHT_MORE = 5;
public ECBlockEditor(PolyDesigner designer, ECBlockCreator creator) {
super(designer, creator);
}
@Override
protected void initDataChangeListener() {
editComponent.addTargetModifiedListener(new TargetModifiedListener() {
@Override
public void targetModified(TargetModifiedEvent e) {
designer.fireTargetModified();
}
});
}
/**
* 获取当前编辑的组件
*
* @return 聚合报表组件
*
*
* @date 2014-11-24-下午3:49:12
*
*/
public ECBlockPane createEffective() {
PolyECBlock pcb = creator.getValue();
if (editComponent == null) {
editComponent = new ECBlockPane(designer, pcb, this);
}
if (DesignerContext.getFormatState() == DesignerContext.FORMAT_STATE_NULL) {
editComponent.getGrid().setCursor(UIConstants.CELL_DEFAULT_CURSOR);
}
return editComponent;
}
@Override
protected void initSize() {
resolution = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getJTemplateResolution();
if (resolution == 0){
resolution = ScreenResolution.getScreenResolution();
}
Dimension cornerSize = getCornerSize();
PolyECBlock block = getValue();
UnitRectangle ub = block.getBounds();
int x = ub.x.toPixI(resolution) - cornerSize.width - designer.getHorizontalValue();
int y = ub.y.toPixI(resolution) - cornerSize.height - designer.getVerticalValue();
int w = ub.width.toPixI(resolution) + cornerSize.width + PolyConstants.OPERATION_SIZE
+ UNITConstants.DELTA.toPixI(resolution);
int h = ub.height.toPixI(resolution) + cornerSize.height + PolyConstants.OPERATION_SIZE
+ UNITConstants.DELTA.toPixI(resolution);
setBounds(x, y, w, h);
editComponent.getGrid().setVerticalExtent(
GridUtils.getExtentValue(0, block.getRowHeightList_DEC(), editComponent.getGrid().getHeight(),
resolution));
editComponent.getGrid().setHorizontalExtent(
GridUtils.getExtentValue(0, block.getColumnWidthList_DEC(), editComponent.getGrid().getWidth(),
resolution));
}
public void setBounds(int x, int y, int width, int height) {
int selfheight = height + HEIGHT_MORE;
super.setBounds(x, y, width, selfheight);
}
@Override
protected Dimension getAddHeigthPreferredSize() {
Dimension cornerSize = getCornerSize();
cornerSize.height = PolyConstants.OPERATION_SIZE;
return cornerSize;
}
@Override
protected Dimension getAddWidthPreferredSize() {
Dimension cornerSize = getCornerSize();
cornerSize.width = PolyConstants.OPERATION_SIZE;
return cornerSize;
}
@Override
protected RowOperationMouseHandler createRowOperationMouseHandler() {
return new RowOperationMouseHandler.ECBlockRowOperationMouseHandler(designer, this);
}
@Override
protected ColumnOperationMouseHandler createColumnOperationMouseHandler() {
return new ColumnOperationMouseHandler.ECBlockColumnOperationMouseHandler(designer, this);
}
@Override
public Dimension getCornerSize() {
return editComponent.getCornerSize();
}
/**
* 重置当前的选择状态, 用于更新右侧属性表
*
*
* @date 2014-11-24-下午3:48:19
*
*/
public void resetSelectionAndChooseState() {
designer.setChooseType(SelectionType.INNER);
if (BaseUtils.isAuthorityEditing()) {
JTemplate jTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
if (jTemplate.isJWorkBook()) {
//清参数面板
jTemplate.removeParameterPaneSelection();
}
designer.noAuthorityEdit();
return;
}
QuickEditorRegion.getInstance().populate(editComponent.getCurrentEditor());
CellElementPropertyPane.getInstance().populate(editComponent);
EastRegionContainerPane.getInstance().replaceCellAttrPane(CellElementPropertyPane.getInstance());
HyperlinkGroupPane hyperlinkGroupPane = DesignerContext.getDesignerFrame().getSelectedJTemplate()
.getHyperLinkPane(HyperlinkGroupPaneActionImpl.getInstance());
hyperlinkGroupPane.populate(editComponent);
}
private static final int HEIGHT_MORE = 5;
public ECBlockEditor(PolyDesigner designer, ECBlockCreator creator) {
super(designer, creator);
}
@Override
protected void initDataChangeListener() {
editComponent.addTargetModifiedListener(new TargetModifiedListener() {
@Override
public void targetModified(TargetModifiedEvent e) {
designer.fireTargetModified();
}
});
}
/**
* 获取当前编辑的组件
*
* @return 聚合报表组件
* @date 2014-11-24-下午3:49:12
*/
public ECBlockPane createEffective() {
PolyECBlock pcb = creator.getValue();
if (editComponent == null) {
editComponent = new ECBlockPane(designer, pcb, this);
}
if (DesignerContext.getFormatState() == DesignerContext.FORMAT_STATE_NULL) {
editComponent.getGrid().setCursor(UIConstants.CELL_DEFAULT_CURSOR);
}
return editComponent;
}
@Override
protected void initSize() {
resolution = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getJTemplateResolution();
if (resolution == 0) {
resolution = ScreenResolution.getScreenResolution();
}
Dimension cornerSize = getCornerSize();
PolyECBlock block = getValue();
UnitRectangle ub = block.getBounds();
int x = ub.x.toPixI(resolution) - cornerSize.width - designer.getHorizontalValue();
int y = ub.y.toPixI(resolution) - cornerSize.height - designer.getVerticalValue();
int w = ub.width.toPixI(resolution) + cornerSize.width + PolyConstants.OPERATION_SIZE
+ UNITConstants.DELTA.toPixI(resolution);
int h = ub.height.toPixI(resolution) + cornerSize.height + PolyConstants.OPERATION_SIZE
+ UNITConstants.DELTA.toPixI(resolution);
setBounds(x, y, w, h);
editComponent.getGrid().setVerticalExtent(
GridUtils.getExtentValue(0, block.getRowHeightList_DEC(), editComponent.getGrid().getHeight(),
resolution));
editComponent.getGrid().setHorizontalExtent(
GridUtils.getExtentValue(0, block.getColumnWidthList_DEC(), editComponent.getGrid().getWidth(),
resolution));
}
public void setBounds(int x, int y, int width, int height) {
int selfheight = height + HEIGHT_MORE;
super.setBounds(x, y, width, selfheight);
}
@Override
protected Dimension getAddHeigthPreferredSize() {
Dimension cornerSize = getCornerSize();
cornerSize.height = PolyConstants.OPERATION_SIZE;
return cornerSize;
}
@Override
protected Dimension getAddWidthPreferredSize() {
Dimension cornerSize = getCornerSize();
cornerSize.width = PolyConstants.OPERATION_SIZE;
return cornerSize;
}
@Override
protected RowOperationMouseHandler createRowOperationMouseHandler() {
return new RowOperationMouseHandler.ECBlockRowOperationMouseHandler(designer, this);
}
@Override
protected ColumnOperationMouseHandler createColumnOperationMouseHandler() {
return new ColumnOperationMouseHandler.ECBlockColumnOperationMouseHandler(designer, this);
}
@Override
public Dimension getCornerSize() {
return editComponent.getCornerSize();
}
/**
* 重置当前的选择状态, 用于更新右侧属性表
*
* @date 2014-11-24-下午3:48:19
*/
public void resetSelectionAndChooseState() {
designer.setChooseType(SelectionType.INNER);
if (BaseUtils.isAuthorityEditing()) {
JTemplate jTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
if (jTemplate.isJWorkBook()) {
//清参数面板
jTemplate.removeParameterPaneSelection();
}
designer.noAuthorityEdit();
return;
}
QuickEditorRegion.getInstance().populate(editComponent.getCurrentEditor());
CellElementPropertyPane.getInstance().populate(editComponent);
Selection Selection = ((JWorkBook) (HistoryTemplateListPane.getInstance().getCurrentEditingTemplate())).getEditingElementCasePane().getSelection();
if (Selection instanceof FloatSelection) {
EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.REPORT_FLOAT);
JPanel floatPane = new JPanel(new BorderLayout());
floatPane.add(ReportFloatPane.getInstance(), BorderLayout.NORTH);
floatPane.add(QuickEditorRegion.getInstance(), BorderLayout.CENTER);
EastRegionContainerPane.getInstance().replaceFloatElementPane(floatPane);
} else {
EastRegionContainerPane.getInstance().replaceFloatElementPane(ReportFloatPane.getInstance());
EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.REPORT);
EastRegionContainerPane.getInstance().replaceCellAttrPane(CellElementPropertyPane.getInstance());
EastRegionContainerPane.getInstance().replaceCellElementPane(QuickEditorRegion.getInstance());
}
EastRegionContainerPane.getInstance().replaceCellAttrPane(CellElementPropertyPane.getInstance());
HyperlinkGroupPane hyperlinkGroupPane = DesignerContext.getDesignerFrame().getSelectedJTemplate()
.getHyperLinkPane(HyperlinkGroupPaneActionImpl.getInstance());
hyperlinkGroupPane.populate(editComponent);
}
}

2
designer/src/com/fr/poly/creator/ECBlockPane.java

@ -10,7 +10,6 @@ import com.fr.page.ReportSettingsProvider;
import com.fr.design.actions.UpdateAction;
import com.fr.design.actions.cell.*;
import com.fr.design.actions.core.ActionFactory;
import com.fr.design.actions.edit.HyperlinkAction;
import com.fr.design.actions.edit.merge.MergeCellAction;
import com.fr.design.actions.edit.merge.UnmergeCellAction;
import com.fr.design.actions.columnrow.InsertColumnAction;
@ -148,7 +147,6 @@ public class ECBlockPane extends PolyElementCasePane {
// 单元格形态
menuDef.addShortCut(DeprecatedActionManager.getPresentMenu(this));
menuDef.addShortCut(new HyperlinkAction(this));
menuDef.addShortCut(SeparatorDef.DEFAULT);
menuDef.addShortCut(new MergeCellAction(this));
menuDef.addShortCut(new UnmergeCellAction(this));

89
designer/src/com/fr/quickeditor/floatquick/FloatImageQuickEditor.java

@ -1,39 +1,37 @@
package com.fr.quickeditor.floatquick;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.*;
import com.fr.base.BaseUtils;
import com.fr.base.Style;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.report.SelectImagePane;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.general.ComparatorUtils;
import com.fr.general.Inter;
import com.fr.quickeditor.FloatQuickEditor;
import com.fr.report.cell.cellattr.CellImage;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class FloatImageQuickEditor extends FloatQuickEditor {
public FloatImageQuickEditor() {
super();
UIButton editbutton = new UIButton(Inter.getLocText("Edit"), BaseUtils.readIcon("/com/fr/design/images/m_insert/image.png"));
editbutton.addActionListener(new ActionListener() {
public FloatImageQuickEditor() {
super();
UIButton editbutton = new UIButton(Inter.getLocText("FR-Designer_Edit"));
editbutton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
showEditingDialog();
}
});
editbutton.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 0));
editbutton.setMargin(null);
editbutton.setOpaque(false);
@Override
public void actionPerformed(ActionEvent e) {
showEditingDialog();
}
});
editbutton.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 0));
editbutton.setMargin(null);
editbutton.setOpaque(false);
Component[][] components = new Component[][]{
new Component[]{editbutton}
};
@ -41,38 +39,39 @@ public class FloatImageQuickEditor extends FloatQuickEditor {
double f = TableLayout.FILL;
double[] columnSize = {f};
double[] rowSize = {p};
JPanel pane = TableLayoutHelper.createTableLayoutPane(components,rowSize,columnSize);
JPanel pane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
this.setLayout(new BorderLayout());
this.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
this.add(pane,BorderLayout.CENTER);
this.setBorder(BorderFactory.createEmptyBorder(10, 74, 10, 10));
this.add(pane, BorderLayout.CENTER);
}
}
private void showEditingDialog() {
final SelectImagePane imageEditorPane = new SelectImagePane();
imageEditorPane.populate(floatElement);
final Object oldValue = floatElement.getValue();
final Style oldStyle = floatElement.getStyle();
imageEditorPane.showWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() {
private void showEditingDialog() {
final SelectImagePane imageEditorPane = new SelectImagePane();
imageEditorPane.populate(floatElement);
final Object oldValue = floatElement.getValue();
final Style oldStyle = floatElement.getStyle();
imageEditorPane.showWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() {
@Override
public void doOk() {
CellImage cellImage = imageEditorPane.update();
if (!ComparatorUtils.equals(cellImage.getImage(), oldValue) || !ComparatorUtils.equals(cellImage.getStyle(), oldStyle)) {
floatElement.setValue(cellImage.getImage());
floatElement.setStyle(cellImage.getStyle());
fireTargetModified();
}
}
@Override
public void doOk() {
CellImage cellImage = imageEditorPane.update();
if (!ComparatorUtils.equals(cellImage.getImage(), oldValue) || !ComparatorUtils.equals(cellImage.getStyle(), oldStyle)) {
floatElement.setValue(cellImage.getImage());
floatElement.setStyle(cellImage.getStyle());
fireTargetModified();
}
}
}).setVisible(true);
}
}).setVisible(true);
}
@Override
protected void refreshDetails() {
// TODO Auto-generated method stub
@Override
protected void refreshDetails() {
// TODO Auto-generated method stub
}
}
}

201
designer/src/com/fr/quickeditor/floatquick/FloatStringQuickEditor.java

@ -1,102 +1,127 @@
package com.fr.quickeditor.floatquick;
import java.awt.*;
import javax.swing.*;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import com.fr.base.BaseUtils;
import com.fr.base.Formula;
import com.fr.base.Style;
import com.fr.base.TextFormat;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.mainframe.ElementCasePane;
import com.fr.quickeditor.FloatQuickEditor;
import com.fr.report.ReportHelper;
import com.fr.stable.StringUtils;
import javax.swing.*;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class FloatStringQuickEditor extends FloatQuickEditor {
private UITextField stringTextField;
// august:如果是原来编辑的是公式,要保留公式里的这些属性,不然在公式和字符串转化时,就会丢失这些属性设置
private boolean reserveInResult = false;
private boolean reserveOnWriteOrAnaly = true;
public FloatStringQuickEditor() {
super();
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] cloumnSize = {f};
double[] rowSize = {p};
stringTextField = new UITextField();
Component[][] components = new Component[][]{
new Component[]{stringTextField}
};
JPanel pane = TableLayoutHelper.createTableLayoutPane(components,rowSize,cloumnSize) ;
private JTextArea stringTextField;
private UIButton formulaButton;
// august:如果是原来编辑的是公式,要保留公式里的这些属性,不然在公式和字符串转化时,就会丢失这些属性设置
private boolean reserveInResult = false;
private boolean reserveOnWriteOrAnaly = true;
public FloatStringQuickEditor() {
super();
stringTextField = new JTextArea();
initTextField();
formulaButton = new UIButton();
formulaButton.setPreferredSize(new Dimension(25, 23));
formulaButton.setIcon(BaseUtils.readIcon("/com/fr/design/images/m_insert/formula.png"));
formulaButton.addActionListener(getFormulaActionListener);
JPanel pane = new JPanel(new BorderLayout(5, 0));
pane.add(stringTextField, BorderLayout.CENTER);
pane.add(formulaButton, BorderLayout.EAST);
formulaButton.setVisible(false);
this.setLayout(new BorderLayout());
this.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
this.add(pane,BorderLayout.CENTER);
}
@Override
protected void refreshDetails() {
String str = null;
Object value = floatElement.getValue();
if (value == null) {
str = StringUtils.EMPTY;
} else if (value instanceof Formula) {
Formula formula = (Formula)value;
str = formula.getContent();
reserveInResult = formula.isReserveInResult();
reserveOnWriteOrAnaly = formula.isReserveOnWriteOrAnaly();
} else {
str = value.toString();
}
showText(str);
}
public void showText(String str) {
stringTextField.getDocument().removeDocumentListener(documentListener);
stringTextField.setText(str);
stringTextField.getDocument().addDocumentListener(documentListener);
}
DocumentListener documentListener = new DocumentListener() {
@Override
public void insertUpdate(DocumentEvent e) {
changeReportPaneCell(stringTextField.getText().trim());
}
@Override
public void removeUpdate(DocumentEvent e) {
changeReportPaneCell(stringTextField.getText().trim());
}
@Override
public void changedUpdate(DocumentEvent e) {
changeReportPaneCell(stringTextField.getText().trim());
}
};
protected void changeReportPaneCell(String tmpText) {
if (tmpText != null && (tmpText.length() > 0 && tmpText.charAt(0) == '=')) {
Formula textFormula = new Formula(tmpText);
textFormula.setReserveInResult(reserveInResult);
textFormula.setReserveOnWriteOrAnaly(reserveOnWriteOrAnaly);
floatElement.setValue(textFormula);
} else {
Style style = floatElement.getStyle();
if (floatElement != null && style != null && style.getFormat() != null && style.getFormat() == TextFormat.getInstance()) {
floatElement.setValue(tmpText);
} else {
floatElement.setValue(ReportHelper.convertGeneralStringAccordingToExcel(tmpText));
}
}
fireTargetModified();
stringTextField.requestFocus();
}
this.add(pane, BorderLayout.NORTH);
}
private void initTextField() {
stringTextField.setFont(new Font("Dialog", Font.PLAIN, 12));
stringTextField.setOpaque(true);
stringTextField.setLineWrap(true);
stringTextField.setWrapStyleWord(true);
stringTextField.setMargin(new Insets(5, 5, 5, 5));
stringTextField.setBorder(BorderFactory.createLineBorder(Color.gray));
stringTextField.setBackground(Color.white);
}
ActionListener getFormulaActionListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
((ElementCasePane) HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getCurrentElementCasePane()).getGrid().startEditing();
}
};
@Override
protected void refreshDetails() {
String str = null;
Object value = floatElement.getValue();
if (value == null) {
str = StringUtils.EMPTY;
} else if (value instanceof Formula) {
//MoMeak: 没拆文本框和公式所以需要这么个玩意
formulaButton.setVisible(true);
Formula formula = (Formula) value;
str = formula.getContent();
stringTextField.setLineWrap(false);
this.setBorder(BorderFactory.createEmptyBorder(10, 74, 10, 10));
reserveInResult = formula.isReserveInResult();
reserveOnWriteOrAnaly = formula.isReserveOnWriteOrAnaly();
} else {
str = value.toString();
}
showText(str);
}
public void showText(String str) {
stringTextField.getDocument().removeDocumentListener(documentListener);
stringTextField.setText(str);
stringTextField.getDocument().addDocumentListener(documentListener);
}
DocumentListener documentListener = new DocumentListener() {
@Override
public void insertUpdate(DocumentEvent e) {
changeReportPaneCell(stringTextField.getText().trim());
}
@Override
public void removeUpdate(DocumentEvent e) {
changeReportPaneCell(stringTextField.getText().trim());
}
@Override
public void changedUpdate(DocumentEvent e) {
changeReportPaneCell(stringTextField.getText().trim());
}
};
protected void changeReportPaneCell(String tmpText) {
if (tmpText != null && (tmpText.length() > 0 && tmpText.charAt(0) == '=')) {
Formula textFormula = new Formula(tmpText);
textFormula.setReserveInResult(reserveInResult);
textFormula.setReserveOnWriteOrAnaly(reserveOnWriteOrAnaly);
floatElement.setValue(textFormula);
} else {
Style style = floatElement.getStyle();
if (floatElement != null && style != null && style.getFormat() != null && style.getFormat() == TextFormat.getInstance()) {
floatElement.setValue(tmpText);
} else {
floatElement.setValue(ReportHelper.convertGeneralStringAccordingToExcel(tmpText));
}
}
fireTargetModified();
stringTextField.requestFocus();
}
}

5
designer_base/src/com/fr/design/gui/controlpane/UIControlPane.java

@ -252,12 +252,13 @@ public abstract class UIControlPane extends BasicPane implements UnrepeatedNameH
// 点击"编辑"按钮,弹出面板
protected class PopupEditDialog extends JDialog {
private JComponent editPane;
private static final int WIDTH = 470;
private static final int HEIGHT = 550;
private static final int WIDTH = 490;
private static final int HEIGHT = 570;
PopupEditDialog(JComponent pane) {
super(DesignerContext.getDesignerFrame());
setUndecorated(true);
pane.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
this.editPane = pane;
this.getContentPane().add(editPane, BorderLayout.CENTER);
setSize(WIDTH, HEIGHT);

6
designer_base/src/com/fr/design/locale/designer.properties

@ -2094,3 +2094,9 @@ FR-Designer_Not_use_a_cell_attribute_table_editing=Not_use_a_cell_attribute_tabl
FR-Designer_CellElement_Property_Table=CellElement_Property_Table
FR-Designer_Use_Params_Template=
FR-Designer_Label_Name=
FR-Designer_T_Insert_Float=Insert_Float
FR-Designer_Add_FloatElement=Add_FloatElement
FR-Designer_Insert_Image=Insert_Image
FR-Designer_Insert-Chart=Insert-Chart
FR-Designer_Insert-Text=Insert-Text
FR-Designer_Insert_Formula=Insert_Formula

6
designer_base/src/com/fr/design/locale/designer_en_US.properties

@ -2095,3 +2095,9 @@ FR-Designer_Not_use_a_cell_attribute_table_editing=Not_use_a_cell_attribute_tabl
FR-Designer_CellElement_Property_Table=CellElement_Property_Table
FR-Designer_Use_Params_Template=use parameter template
FR-Designer_Label_Name=label name
FR-Designer_T_Insert_Float=Insert_Float
FR-Designer_Add_FloatElement=Add_FloatElement
FR-Designer_Insert_Image=Insert_Image
FR-Designer_Insert_Chart=Insert-Chart
FR-Designer_Insert_Text=Insert-Text
FR-Designer_Insert_Formula=Insert_Formula

5
designer_base/src/com/fr/design/locale/designer_ja_JP.properties

@ -2075,3 +2075,8 @@ FR-Designer_CellWrite_Show_As_HTML=
FR-Designer_Datasource_Other_Attributes=
FR-Designer_Not_use_a_cell_attribute_table_editing=
FR-Designer_CellElement_Property_Table=
FR-Designer_T_Insert_Float=
FR-Designer_Add_FloatElement=
FR-Designer_Insert_Image=
FR-Designer_Insert_Chart=
FR-Designer_Insert_Text=

6
designer_base/src/com/fr/design/locale/designer_ko_KR.properties

@ -2073,3 +2073,9 @@ FR-Designer_CellWrite_Show_As_HTML=
FR-Designer_Datasource_Other_Attributes=
FR-Designer_Not_use_a_cell_attribute_table_editing=
FR-Designer_CellElement_Property_Table=
FR-Designer_T_Insert_Float=
FR-Designer_Add_FloatElement=
FR-Designer_Insert_Image=
FR-Designer_Insert_Chart=
FR-Designer_Insert_Text=
FR-Designer_Insert_Formula=

6
designer_base/src/com/fr/design/locale/designer_zh_CN.properties

@ -2094,3 +2094,9 @@ FR-Designer_Not_use_a_cell_attribute_table_editing=\u60A8\u4E0D\u53EF\u4EE5\u752
FR-Designer_CellElement_Property_Table=\u5355\u5143\u683C\u5C5E\u6027\u8868
FR-Designer_Use_Params_Template=\u4F7F\u7528\u5E38\u7528\u53C2\u6570\u7EC4\u5408
FR-Designer_Label_Name=\u6807\u7B7E\u540D\u79F0
FR-Designer_T_Insert_Float=\u63D2\u5165\u60AC\u6D6E\u5143\u7D20
FR-Designer_Add_FloatElement=\u6DFB\u52A0\u5143\u7D20
FR-Designer_Insert_Image=\u63D2\u5165\u56FE\u7247
FR-Designer_Insert_Chart=\u63D2\u5165\u56FE\u8868
FR-Designer_Insert_Text=\u63D2\u5165\u666E\u901A\u6587\u672C
FR-Designer_Insert_Formula=\u63D2\u5165\u516C\u5F0F

6
designer_base/src/com/fr/design/locale/designer_zh_TW.properties

@ -2092,3 +2092,9 @@ FR-Designer_CellWrite_Show_As_HTML=
FR-Designer_Datasource_Other_Attributes=
FR-Designer_Not_use_a_cell_attribute_table_editing=
FR-Designer_CellElement_Property_Table=
FR-Designer_T_Insert_Float=
FR-Designer_Add_FloatElement=
FR-Designer_Insert_Image=
FR-Designer_Insert_Chart=
FR-Designer_Insert_Text=
FR-Designer_Insert_Formula=

36
designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java

@ -301,7 +301,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
}
public void addParameterPane(JComponent paraPane) {
// propertyItemMap.get(KEY_HYPERLINK).replaceContentPane(paraPane);
propertyItemMap.get(KEY_WIDGET_SETTINGS).replaceHeaderPane(paraPane);
}
public void setParameterHeight(int height) {
@ -340,7 +340,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
}
public void removeParameterPane() {
propertyItemMap.get(KEY_WIDGET_SETTINGS).removeHeaderPane();
}
/**
@ -396,6 +396,8 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
private String title; // 用于显示
private JComponent propertyPanel;
private JComponent contentPane;
private JComponent headerPane; // 在contentPane 上方,可以用于显示参数面板
private Container contentArea; // 包含 headerPane 和 contentPane
private FixedPopupPane popupPane; // 左侧固定弹出框
private PopupToolPane popupToolPane; // 弹出工具条
private PopupDialog popupDialog; // 弹出框
@ -404,6 +406,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
private boolean isEnabled = true; // 是否可用
private Set<PropertyMode> visibleModes;
private Set<PropertyMode> enableModes;
private static final int MAX_PARA_HEIGHT = 240;
public PropertyItem(String name, String title, String btnUrl, PropertyMode[] visibleModes, PropertyMode[] enableModes) {
this.name = name;
@ -454,9 +457,13 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
propertyPanel.setBackground(Color.pink);
contentPane = generateContentPane();
popupToolPane = new PopupToolPane(this, PopupToolPane.DOWN_BUTTON);
headerPane = new JPanel();
contentArea = new JPanel(new BorderLayout());
contentArea.add(headerPane, BorderLayout.NORTH);
contentArea.add(contentPane, BorderLayout.CENTER);
propertyPanel.setLayout(new BorderLayout());
propertyPanel.add(popupToolPane, BorderLayout.NORTH);
propertyPanel.add(contentPane, BorderLayout.CENTER);
propertyPanel.add(contentArea, BorderLayout.CENTER);
}
public boolean isPoppedOut() {
@ -477,8 +484,8 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
}
public void replaceContentPane(JComponent pane) {
propertyPanel.remove(this.contentPane);
propertyPanel.add(this.contentPane = pane);
contentArea.remove(this.contentPane);
contentArea.add(this.contentPane = pane);
if (popupDialog != null && isPoppedOut) {
popupDialog.replaceContentPane(this);
}
@ -493,6 +500,25 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
return contentPane;
}
public void replaceHeaderPane(JComponent pane) {
contentArea.remove(headerPane);
int height = Math.min(pane.getPreferredSize().height, MAX_PARA_HEIGHT);
pane.setPreferredSize(new Dimension(pane.getPreferredSize().width, height));
headerPane = pane;
contentArea.add(headerPane, BorderLayout.NORTH);
refreshContainer();
}
public void removeHeaderPane() {
contentArea.remove(headerPane);
refreshContainer();
}
public JComponent getHeaderPane() {
return headerPane;
}
public void onResize() {
if (isRightPaneVisible()) {
hideCurrentPopupPane();

Loading…
Cancel
Save