Browse Source

REPORT-3564 9.0设计器单元格元素插入内容控件

master
vito 7 years ago
parent
commit
9bdc72ad64
  1. 5
      designer/src/com/fr/design/actions/CellSelectionAction.java
  2. 8
      designer/src/com/fr/design/actions/ElementCaseAction.java
  3. 5
      designer/src/com/fr/design/actions/SelectionListenerAction.java
  4. 4
      designer/src/com/fr/design/actions/insert/cell/AbstractCellAction.java
  5. 13
      designer/src/com/fr/design/actions/insert/cell/BiasCellAction.java
  6. 8
      designer/src/com/fr/design/actions/insert/cell/ChartCellAction.java
  7. 12
      designer/src/com/fr/design/actions/insert/cell/DSColumnCellAction.java
  8. 10
      designer/src/com/fr/design/actions/insert/cell/FormulaCellAction.java
  9. 10
      designer/src/com/fr/design/actions/insert/cell/GeneralCellAction.java
  10. 10
      designer/src/com/fr/design/actions/insert/cell/ImageCellAction.java
  11. 21
      designer/src/com/fr/design/actions/insert/cell/RichTextCellAction.java
  12. 21
      designer/src/com/fr/design/actions/insert/cell/SubReportCellAction.java
  13. 78
      designer/src/com/fr/quickeditor/CellQuickEditor.java
  14. 7
      designer/src/com/fr/quickeditor/cellquick/CellBiasTextPainterEditor.java
  15. 7
      designer/src/com/fr/quickeditor/cellquick/CellDSColumnEditor.java
  16. 6
      designer/src/com/fr/quickeditor/cellquick/CellImageQuickEditor.java
  17. 6
      designer/src/com/fr/quickeditor/cellquick/CellRichTextEditor.java
  18. 10
      designer/src/com/fr/quickeditor/cellquick/CellStringQuickEditor.java
  19. 6
      designer/src/com/fr/quickeditor/cellquick/CellSubReportEditor.java
  20. 4
      designer_base/src/com/fr/design/actions/TemplateComponentAction.java
  21. 34
      designer_base/src/com/fr/design/actions/core/ActionFactory.java

5
designer/src/com/fr/design/actions/CellSelectionAction.java

@ -5,6 +5,9 @@ import com.fr.grid.selection.CellSelection;
import com.fr.grid.selection.Selection; import com.fr.grid.selection.Selection;
public abstract class CellSelectionAction extends ElementCaseAction { public abstract class CellSelectionAction extends ElementCaseAction {
protected CellSelectionAction() {
}
protected CellSelectionAction(ElementCasePane t) { protected CellSelectionAction(ElementCasePane t) {
super(t); super(t);
} }
@ -16,7 +19,7 @@ public abstract class CellSelectionAction extends ElementCaseAction {
// TODO ALEX_SEP instanceof i hate it // TODO ALEX_SEP instanceof i hate it
if (s instanceof CellSelection) { if (s instanceof CellSelection) {
return executeActionReturnUndoRecordNeededWithCellSelection((CellSelection)s); return executeActionReturnUndoRecordNeededWithCellSelection((CellSelection) s);
} }
return false; return false;

8
designer/src/com/fr/design/actions/ElementCaseAction.java

@ -3,14 +3,12 @@ package com.fr.design.actions;
//ElementCaseAction应该有GridSelectionChangeListener,就从悬浮元素和单元格来讲,就必须有了,用来判断这些ElementCaseAction是否可以编辑,当然还可以做些其他事情 //ElementCaseAction应该有GridSelectionChangeListener,就从悬浮元素和单元格来讲,就必须有了,用来判断这些ElementCaseAction是否可以编辑,当然还可以做些其他事情
// //
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.ElementCasePane; import com.fr.design.mainframe.ElementCasePane;
import com.fr.grid.selection.CellSelection;
import com.fr.grid.selection.Selection;
import com.fr.design.selection.SelectionEvent;
import com.fr.design.selection.SelectionListener;
public abstract class ElementCaseAction extends SelectionListenerAction { public abstract class ElementCaseAction extends SelectionListenerAction {
protected ElementCaseAction() {
}
protected ElementCaseAction(ElementCasePane t) { protected ElementCaseAction(ElementCasePane t) {
super(t); super(t);
t.addSelectionChangeListener(createSelectionListener()); t.addSelectionChangeListener(createSelectionListener());

5
designer/src/com/fr/design/actions/SelectionListenerAction.java

@ -12,11 +12,14 @@ import com.fr.grid.selection.Selection;
*/ */
public abstract class SelectionListenerAction extends TemplateComponentAction<ElementCasePane> { public abstract class SelectionListenerAction extends TemplateComponentAction<ElementCasePane> {
protected SelectionListenerAction() {
}
protected SelectionListenerAction(ElementCasePane elementCasePane) { protected SelectionListenerAction(ElementCasePane elementCasePane) {
super(elementCasePane); super(elementCasePane);
} }
protected SelectionListener createSelectionListener () { protected SelectionListener createSelectionListener() {
return new SelectionListener() { return new SelectionListener() {
@Override @Override

4
designer/src/com/fr/design/actions/insert/cell/AbstractCellAction.java

@ -13,6 +13,9 @@ import com.fr.report.elementcase.TemplateElementCase;
* Cell. * Cell.
*/ */
public abstract class AbstractCellAction extends CellSelectionAction { public abstract class AbstractCellAction extends CellSelectionAction {
protected AbstractCellAction() {
}
protected AbstractCellAction(ElementCasePane t) { protected AbstractCellAction(ElementCasePane t) {
super(t); super(t);
} }
@ -42,6 +45,7 @@ public abstract class AbstractCellAction extends CellSelectionAction {
this.getCellValueClass(), false this.getCellValueClass(), false
); );
} }
@Override @Override
public void update() { public void update() {
super.update(); super.update();

13
designer/src/com/fr/design/actions/insert/cell/BiasCellAction.java

@ -3,8 +3,6 @@
*/ */
package com.fr.design.actions.insert.cell; package com.fr.design.actions.insert.cell;
import javax.swing.KeyStroke;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.design.actions.core.WorkBookSupportable; import com.fr.design.actions.core.WorkBookSupportable;
import com.fr.design.mainframe.ElementCasePane; import com.fr.design.mainframe.ElementCasePane;
@ -12,12 +10,23 @@ import com.fr.design.menu.MenuKeySet;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.report.cell.painter.BiasTextPainter; import com.fr.report.cell.painter.BiasTextPainter;
import javax.swing.KeyStroke;
/** /**
* Bias * Bias
*/ */
public class BiasCellAction extends AbstractCellAction implements WorkBookSupportable { public class BiasCellAction extends AbstractCellAction implements WorkBookSupportable {
public BiasCellAction() {
initAction();
}
public BiasCellAction(ElementCasePane t) { public BiasCellAction(ElementCasePane t) {
super(t); super(t);
initAction();
}
private void initAction() {
this.setMenuKeySet(INSERT_SLOPE_LINE); this.setMenuKeySet(INSERT_SLOPE_LINE);
this.setName(getMenuKeySet().getMenuKeySetName()+ "..."); this.setName(getMenuKeySet().getMenuKeySetName()+ "...");
this.setMnemonic(getMenuKeySet().getMnemonic()); this.setMnemonic(getMenuKeySet().getMnemonic());

8
designer/src/com/fr/design/actions/insert/cell/ChartCellAction.java

@ -16,8 +16,16 @@ import javax.swing.*;
* . * .
*/ */
public class ChartCellAction extends AbstractCellAction implements WorkBookSupportable { public class ChartCellAction extends AbstractCellAction implements WorkBookSupportable {
public ChartCellAction(){
initAction();
}
public ChartCellAction(ElementCasePane t) { public ChartCellAction(ElementCasePane t) {
super(t); super(t);
initAction();
}
private void initAction() {
this.setMenuKeySet(INSERT_CHART); this.setMenuKeySet(INSERT_CHART);
this.setName(getMenuKeySet().getMenuKeySetName()+ "..."); this.setName(getMenuKeySet().getMenuKeySetName()+ "...");
this.setMnemonic(getMenuKeySet().getMnemonic()); this.setMnemonic(getMenuKeySet().getMnemonic());

12
designer/src/com/fr/design/actions/insert/cell/DSColumnCellAction.java

@ -8,13 +8,21 @@ import com.fr.general.IOUtils;
import com.fr.report.cell.cellattr.core.group.DSColumn; import com.fr.report.cell.cellattr.core.group.DSColumn;
public class DSColumnCellAction extends AbstractCellAction implements WorkBookSupportable { public class DSColumnCellAction extends AbstractCellAction implements WorkBookSupportable {
public DSColumnCellAction() {
initAction();
}
public DSColumnCellAction(ElementCasePane t) { public DSColumnCellAction(ElementCasePane t) {
super(t); super(t);
initAction();
this.setSearchText(new DSColumnPane());
}
private void initAction() {
this.setMenuKeySet(KeySetUtils.INSERT_DATA_COLUMN); this.setMenuKeySet(KeySetUtils.INSERT_DATA_COLUMN);
this.setName(getMenuKeySet().getMenuKeySetName()+ "..."); this.setName(getMenuKeySet().getMenuKeySetName() + "...");
this.setMnemonic(getMenuKeySet().getMnemonic()); this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(IOUtils.readIcon("/com/fr/design/images/m_insert/bindColumn.png")); this.setSmallIcon(IOUtils.readIcon("/com/fr/design/images/m_insert/bindColumn.png"));
this.setSearchText(new DSColumnPane());
} }
@Override @Override

10
designer/src/com/fr/design/actions/insert/cell/FormulaCellAction.java

@ -13,10 +13,18 @@ import com.fr.general.Inter;
import javax.swing.*; import javax.swing.*;
public class FormulaCellAction extends AbstractCellAction implements WorkBookSupportable { public class FormulaCellAction extends AbstractCellAction implements WorkBookSupportable {
public FormulaCellAction() {
initAction();
}
public FormulaCellAction(ElementCasePane t) { public FormulaCellAction(ElementCasePane t) {
super(t); super(t);
initAction();
}
private void initAction() {
this.setMenuKeySet(INSERT_FORMULA); this.setMenuKeySet(INSERT_FORMULA);
this.setName(getMenuKeySet().getMenuKeySetName()+ "..."); this.setName(getMenuKeySet().getMenuKeySetName() + "...");
this.setMnemonic(getMenuKeySet().getMnemonic()); this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_insert/formula.png")); this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_insert/formula.png"));
} }

10
designer/src/com/fr/design/actions/insert/cell/GeneralCellAction.java

@ -15,10 +15,18 @@ import javax.swing.*;
* *
*/ */
public class GeneralCellAction extends AbstractCellAction implements WorkBookSupportable { public class GeneralCellAction extends AbstractCellAction implements WorkBookSupportable {
public GeneralCellAction() {
initAction();
}
public GeneralCellAction(ElementCasePane t) { public GeneralCellAction(ElementCasePane t) {
super(t); super(t);
initAction();
}
private void initAction() {
this.setMenuKeySet(INSERT_TEXT); this.setMenuKeySet(INSERT_TEXT);
this.setName(getMenuKeySet().getMenuKeySetName()+ "..."); this.setName(getMenuKeySet().getMenuKeySetName() + "...");
this.setMnemonic(getMenuKeySet().getMnemonic()); this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_insert/text.png")); this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_insert/text.png"));
} }

10
designer/src/com/fr/design/actions/insert/cell/ImageCellAction.java

@ -16,10 +16,18 @@ import java.awt.*;
* Image * Image
*/ */
public class ImageCellAction extends AbstractCellAction implements WorkBookSupportable { public class ImageCellAction extends AbstractCellAction implements WorkBookSupportable {
public ImageCellAction() {
initAction();
}
public ImageCellAction(ElementCasePane t) { public ImageCellAction(ElementCasePane t) {
super(t); super(t);
initAction();
}
private void initAction() {
this.setMenuKeySet(INSERT_IMAGE); this.setMenuKeySet(INSERT_IMAGE);
this.setName(getMenuKeySet().getMenuKeySetName()+ "..."); this.setName(getMenuKeySet().getMenuKeySetName() + "...");
this.setMnemonic(getMenuKeySet().getMnemonic()); this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_insert/image.png")); this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_insert/image.png"));
} }

21
designer/src/com/fr/design/actions/insert/cell/RichTextCellAction.java

@ -1,7 +1,5 @@
package com.fr.design.actions.insert.cell; package com.fr.design.actions.insert.cell;
import javax.swing.KeyStroke;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.design.actions.core.WorkBookSupportable; import com.fr.design.actions.core.WorkBookSupportable;
import com.fr.design.mainframe.ElementCasePane; import com.fr.design.mainframe.ElementCasePane;
@ -10,12 +8,22 @@ import com.fr.general.ComparatorUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.report.cell.cellattr.core.RichText; import com.fr.report.cell.cellattr.core.RichText;
import javax.swing.KeyStroke;
public class RichTextCellAction extends AbstractCellAction implements WorkBookSupportable { public class RichTextCellAction extends AbstractCellAction implements WorkBookSupportable {
public RichTextCellAction() {
initAction();
}
public RichTextCellAction(ElementCasePane t) { public RichTextCellAction(ElementCasePane t) {
super(t); super(t);
initAction();
}
private void initAction() {
this.setMenuKeySet(INSERT_RICHTEXT); this.setMenuKeySet(INSERT_RICHTEXT);
this.setName(getMenuKeySet().getMenuKeySetName()+ "..."); this.setName(getMenuKeySet().getMenuKeySetName() + "...");
this.setMnemonic(getMenuKeySet().getMnemonic()); this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(BaseUtils.readIcon( this.setSmallIcon(BaseUtils.readIcon(
"/com/fr/design/images/m_insert/richtext.png")); "/com/fr/design/images/m_insert/richtext.png"));
@ -28,19 +36,20 @@ public class RichTextCellAction extends AbstractCellAction implements WorkBookSu
/** /**
* equals 比较 * equals 比较
*
* @param object * @param object
* @return true false * @return true false
*/ */
@Override @Override
public boolean equals(Object object) { public boolean equals(Object object) {
if (this == object){ if (this == object) {
return true; return true;
} }
if (!(object instanceof RichTextCellAction)){ if (!(object instanceof RichTextCellAction)) {
return false; return false;
} }
return ComparatorUtils.equals(this.getEditingComponent(),((RichTextCellAction)object).getEditingComponent()); return ComparatorUtils.equals(this.getEditingComponent(), ((RichTextCellAction) object).getEditingComponent());
} }
private static final MenuKeySet INSERT_RICHTEXT = new MenuKeySet() { private static final MenuKeySet INSERT_RICHTEXT = new MenuKeySet() {

21
designer/src/com/fr/design/actions/insert/cell/SubReportCellAction.java

@ -1,7 +1,5 @@
package com.fr.design.actions.insert.cell; package com.fr.design.actions.insert.cell;
import javax.swing.KeyStroke;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.design.mainframe.ElementCasePane; import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.menu.MenuKeySet; import com.fr.design.menu.MenuKeySet;
@ -9,12 +7,22 @@ import com.fr.general.ComparatorUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.report.cell.cellattr.core.SubReport; import com.fr.report.cell.cellattr.core.SubReport;
import javax.swing.KeyStroke;
public class SubReportCellAction extends AbstractCellAction { public class SubReportCellAction extends AbstractCellAction {
public SubReportCellAction() {
initAction();
}
public SubReportCellAction(ElementCasePane t) { public SubReportCellAction(ElementCasePane t) {
super(t); super(t);
initAction();
}
private void initAction() {
this.setMenuKeySet(INSERT_SUB_REPORT); this.setMenuKeySet(INSERT_SUB_REPORT);
this.setName(getMenuKeySet().getMenuKeySetName()+ "..."); this.setName(getMenuKeySet().getMenuKeySetName() + "...");
this.setMnemonic(getMenuKeySet().getMnemonic()); this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(BaseUtils.readIcon( this.setSmallIcon(BaseUtils.readIcon(
"/com/fr/design/images/m_insert/subReport.png")); "/com/fr/design/images/m_insert/subReport.png"));
@ -39,19 +47,20 @@ public class SubReportCellAction extends AbstractCellAction {
/** /**
* equals 比较 * equals 比较
*
* @param object * @param object
* @return true false * @return true false
*/ */
@Override @Override
public boolean equals(Object object) { public boolean equals(Object object) {
if (this == object){ if (this == object) {
return true; return true;
} }
if (!(object instanceof SubReportCellAction)){ if (!(object instanceof SubReportCellAction)) {
return false; return false;
} }
return ComparatorUtils.equals(this.getEditingComponent(),((SubReportCellAction)object).getEditingComponent()); return ComparatorUtils.equals(this.getEditingComponent(), ((SubReportCellAction) object).getEditingComponent());
} }
@Override @Override

78
designer/src/com/fr/quickeditor/CellQuickEditor.java

@ -1,27 +1,30 @@
package com.fr.quickeditor; package com.fr.quickeditor;
import com.fr.base.BaseUtils; import com.fr.design.actions.UpdateAction;
import com.fr.design.actions.utils.DeprecatedActionManager; import com.fr.design.actions.core.ActionFactory;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.ElementCasePane; import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.menu.MenuKeySet;
import com.fr.design.menu.ShortCut;
import com.fr.design.selection.QuickEditor; import com.fr.design.selection.QuickEditor;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.grid.selection.CellSelection; import com.fr.grid.selection.CellSelection;
import com.fr.report.cell.TemplateCellElement; import com.fr.report.cell.TemplateCellElement;
import com.fr.stable.ColumnRow; import com.fr.stable.ColumnRow;
import javax.swing.*; import javax.swing.*;
import javax.swing.event.PopupMenuEvent;
import javax.swing.event.PopupMenuListener;
import java.awt.*; import java.awt.*;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter; import java.util.ArrayList;
import java.awt.event.MouseEvent;
/** /**
* @author zhou * @author zhou
@ -32,6 +35,10 @@ public abstract class CellQuickEditor extends QuickEditor<ElementCasePane> {
protected UITextField columnRowTextField; protected UITextField columnRowTextField;
private UIButton cellElementEditButton; private UIButton cellElementEditButton;
protected TemplateCellElement cellElement; protected TemplateCellElement cellElement;
protected UIComboBox comboBox;
private UpdateAction[] cellInsertActions;
private MenuKeySet[] cellInsertActionNames;
private int selectedIndex;
public CellQuickEditor() { public CellQuickEditor() {
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
@ -40,7 +47,7 @@ public abstract class CellQuickEditor extends QuickEditor<ElementCasePane> {
double[] rowSize = {p, p, p}; double[] rowSize = {p, p, p};
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{new UILabel(" " + Inter.getLocText("Cell")), columnRowTextField = initColumnRowTextField()}, new Component[]{new UILabel(" " + Inter.getLocText("Cell")), columnRowTextField = initColumnRowTextField()},
new Component[]{new UILabel(Inter.getLocText("HF-Insert_Content") + " "), cellElementEditButton = initCellElementEditButton()}, new Component[]{new UILabel(Inter.getLocText("HF-Insert_Content") + " "), initCellElementEditComboBox()},
new Component[]{createCenterBody(), null} new Component[]{createCenterBody(), null}
}; };
JPanel panel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); JPanel panel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
@ -51,20 +58,57 @@ public abstract class CellQuickEditor extends QuickEditor<ElementCasePane> {
/** /**
* 初始化添加按钮 * 初始化添加按钮
* TODO 9.0 换成下拉菜单后原来的快捷键不好处理先跳过
* *
* @return UIButton * @return UIButton
*/ */
private UIButton initCellElementEditButton() { private UIComboBox initCellElementEditComboBox() {
final UIButton cellElementEditButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/buttonicon/add.png")); final String[] items = getDefaultComboBoxItems();
cellElementEditButton.addMouseListener(new MouseAdapter() { comboBox = new UIComboBox(items);
final Object comboBoxSelected = getComboBoxSelected();
if (comboBoxSelected != null) {
comboBox.setSelectedItem(((ShortCut) comboBoxSelected).getMenuKeySet().getMenuKeySetName());
} else {
comboBox.setSelectedIndex(1);
}
comboBox.addPopupMenuListener(new PopupMenuListener() {
@Override
public void popupMenuWillBecomeVisible(PopupMenuEvent e) {
if (cellInsertActions == null) {
cellInsertActions = ActionFactory.createCellInsertAction(ElementCasePane.class, tc);
}
// 这边重新获取是因为要根据JTemplate做一个过滤
ArrayList<String> arrayList = new ArrayList<String>();
for (UpdateAction action : cellInsertActions) {
arrayList.add(action.getMenuKeySet().getMenuKeySetName());
}
comboBox.setModel(new DefaultComboBoxModel(arrayList.toArray(new String[arrayList.size()])));
}
@Override @Override
public void mousePressed(MouseEvent evt) { public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {
GUICoreUtils.showPopMenuWithParentWidth(DeprecatedActionManager.getCellMenu(tc).createJPopupMenu(), cellElementEditButton, 0, cellElementEditButton.getY() - 6); }
@Override
public void popupMenuCanceled(PopupMenuEvent e) {
} }
}); });
return cellElementEditButton; comboBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
selectedIndex = comboBox.getSelectedIndex();
cellInsertActions[selectedIndex].actionPerformed(e);
}
});
return comboBox;
}
private String[] getDefaultComboBoxItems() {
cellInsertActionNames = ActionFactory.createCellInsertActionName();
ArrayList<String> names = new ArrayList<>();
for (MenuKeySet cellInsertActionName : cellInsertActionNames) {
names.add(cellInsertActionName.getMenuKeySetName());
}
return names.toArray(new String[names.size()]);
} }
/** /**
@ -110,6 +154,14 @@ public abstract class CellQuickEditor extends QuickEditor<ElementCasePane> {
*/ */
public abstract JComponent createCenterBody(); public abstract JComponent createCenterBody();
/**
* 初始化下拉框中的类型
*
* @return JComponent 待显示的详细信息面板
*/
public abstract Object getComboBoxSelected();
/** /**
* 刷新 * 刷新
*/ */

7
designer/src/com/fr/quickeditor/cellquick/CellBiasTextPainterEditor.java

@ -1,6 +1,8 @@
package com.fr.quickeditor.cellquick; package com.fr.quickeditor.cellquick;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.design.actions.core.ActionFactory;
import com.fr.design.actions.insert.cell.BiasCellAction;
import com.fr.design.cell.editor.BiasTextPainterCellEditor.BiasTextPainterPane; import com.fr.design.cell.editor.BiasTextPainterCellEditor.BiasTextPainterPane;
import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
@ -36,6 +38,11 @@ public class CellBiasTextPainterEditor extends CellQuickEditor {
return editbutton; return editbutton;
} }
@Override
public Object getComboBoxSelected() {
return ActionFactory.createAction(BiasCellAction.class);
}
private void showEditingDialog() { private void showEditingDialog() {
final BiasTextPainter oldbiasTextPainter = (BiasTextPainter) cellElement.getValue(); final BiasTextPainter oldbiasTextPainter = (BiasTextPainter) cellElement.getValue();
final BiasTextPainterPane biasTextPainterPane = new BiasTextPainterPane(); final BiasTextPainterPane biasTextPainterPane = new BiasTextPainterPane();

7
designer/src/com/fr/quickeditor/cellquick/CellDSColumnEditor.java

@ -1,6 +1,8 @@
package com.fr.quickeditor.cellquick; package com.fr.quickeditor.cellquick;
import com.fr.design.actions.columnrow.DSColumnConditionAction; import com.fr.design.actions.columnrow.DSColumnConditionAction;
import com.fr.design.actions.core.ActionFactory;
import com.fr.design.actions.insert.cell.DSColumnCellAction;
import com.fr.design.dscolumn.DSColumnAdvancedEditorPane; import com.fr.design.dscolumn.DSColumnAdvancedEditorPane;
import com.fr.design.dscolumn.DSColumnBasicEditorPane; import com.fr.design.dscolumn.DSColumnBasicEditorPane;
import com.fr.design.dscolumn.ResultSetGroupDockingPane; import com.fr.design.dscolumn.ResultSetGroupDockingPane;
@ -198,4 +200,9 @@ public class CellDSColumnEditor extends CellQuickEditor {
/*高级设置面板*/ /*高级设置面板*/
paneList.add(new DSColumnAdvancedEditorPane()); paneList.add(new DSColumnAdvancedEditorPane());
} }
@Override
public Object getComboBoxSelected() {
return ActionFactory.createAction(DSColumnCellAction.class);
}
} }

6
designer/src/com/fr/quickeditor/cellquick/CellImageQuickEditor.java

@ -2,6 +2,8 @@ package com.fr.quickeditor.cellquick;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.Style; import com.fr.base.Style;
import com.fr.design.actions.core.ActionFactory;
import com.fr.design.actions.insert.cell.ImageCellAction;
import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
@ -74,4 +76,8 @@ public class CellImageQuickEditor extends CellQuickEditor {
} }
@Override
public Object getComboBoxSelected() {
return ActionFactory.createAction(ImageCellAction.class);
}
} }

6
designer/src/com/fr/quickeditor/cellquick/CellRichTextEditor.java

@ -1,5 +1,6 @@
package com.fr.quickeditor.cellquick; package com.fr.quickeditor.cellquick;
import com.fr.design.actions.core.ActionFactory;
import com.fr.design.actions.insert.cell.RichTextCellAction; import com.fr.design.actions.insert.cell.RichTextCellAction;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.general.Inter; import com.fr.general.Inter;
@ -40,6 +41,11 @@ public class CellRichTextEditor extends CellQuickEditor {
return subReportButton; return subReportButton;
} }
@Override
public Object getComboBoxSelected() {
return ActionFactory.createAction(RichTextCellAction.class);
}
@Override @Override
protected void refreshDetails() { protected void refreshDetails() {
RichTextCellAction subReportCellAction = new RichTextCellAction(tc); RichTextCellAction subReportCellAction = new RichTextCellAction(tc);

10
designer/src/com/fr/quickeditor/cellquick/CellStringQuickEditor.java

@ -3,6 +3,8 @@ package com.fr.quickeditor.cellquick;
import com.fr.base.Formula; import com.fr.base.Formula;
import com.fr.base.Style; import com.fr.base.Style;
import com.fr.base.TextFormat; import com.fr.base.TextFormat;
import com.fr.design.actions.core.ActionFactory;
import com.fr.design.actions.insert.cell.FormulaCellAction;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
import com.fr.grid.selection.CellSelection; import com.fr.grid.selection.CellSelection;
import com.fr.quickeditor.CellQuickEditor; import com.fr.quickeditor.CellQuickEditor;
@ -21,6 +23,7 @@ import java.awt.event.KeyEvent;
* *
*/ */
public class CellStringQuickEditor extends CellQuickEditor { public class CellStringQuickEditor extends CellQuickEditor {
private Object selectedItem;
//instance //instance
private static CellStringQuickEditor THIS; private static CellStringQuickEditor THIS;
//文本域 //文本域
@ -99,6 +102,7 @@ public class CellStringQuickEditor extends CellQuickEditor {
textFormula.setReserveInResult(reserveInResult); textFormula.setReserveInResult(reserveInResult);
textFormula.setReserveOnWriteOrAnaly(reserveOnWriteOrAnaly); textFormula.setReserveOnWriteOrAnaly(reserveOnWriteOrAnaly);
cellElement.setValue(textFormula); cellElement.setValue(textFormula);
selectedItem = ActionFactory.createAction(FormulaCellAction.class);
} else { } else {
Style style = cellElement.getStyle(); Style style = cellElement.getStyle();
if (style != null && style.getFormat() != null && style.getFormat() == TextFormat.getInstance()) { if (style != null && style.getFormat() != null && style.getFormat() == TextFormat.getInstance()) {
@ -106,6 +110,7 @@ public class CellStringQuickEditor extends CellQuickEditor {
} else { } else {
cellElement.setValue(ReportHelper.convertGeneralStringAccordingToExcel(tmpText)); cellElement.setValue(ReportHelper.convertGeneralStringAccordingToExcel(tmpText));
} }
selectedItem = null;
} }
fireTargetModified(); fireTargetModified();
stringTextField.requestFocus(); stringTextField.requestFocus();
@ -152,4 +157,9 @@ public class CellStringQuickEditor extends CellQuickEditor {
stringTextField.getDocument().addDocumentListener(documentListener); stringTextField.getDocument().addDocumentListener(documentListener);
} }
@Override
public Object getComboBoxSelected() {
return selectedItem;
}
} }

6
designer/src/com/fr/quickeditor/cellquick/CellSubReportEditor.java

@ -1,5 +1,6 @@
package com.fr.quickeditor.cellquick; package com.fr.quickeditor.cellquick;
import com.fr.design.actions.core.ActionFactory;
import com.fr.design.actions.insert.cell.SubReportCellAction; import com.fr.design.actions.insert.cell.SubReportCellAction;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.general.Inter; import com.fr.general.Inter;
@ -42,4 +43,9 @@ public class CellSubReportEditor extends CellQuickEditor {
subReportButton.setAction(subReportCellAction); subReportButton.setAction(subReportCellAction);
} }
@Override
public Object getComboBoxSelected() {
return ActionFactory.createAction(SubReportCellAction.class);
}
} }

4
designer_base/src/com/fr/design/actions/TemplateComponentAction.java

@ -5,6 +5,10 @@ import com.fr.design.designer.TargetComponent;
public abstract class TemplateComponentAction<T extends TargetComponent> extends UndoableAction implements TemplateComponentActionInterface<T> { public abstract class TemplateComponentAction<T extends TargetComponent> extends UndoableAction implements TemplateComponentActionInterface<T> {
private T t; private T t;
protected TemplateComponentAction() {
}
protected TemplateComponentAction(T t) { protected TemplateComponentAction(T t) {
this.t = t; this.t = t;
} }

34
designer_base/src/com/fr/design/actions/core/ActionFactory.java

@ -5,6 +5,7 @@ import com.fr.base.Utils;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplate;
import com.fr.design.menu.MenuKeySet;
import com.fr.design.selection.QuickEditor; import com.fr.design.selection.QuickEditor;
import javax.swing.*; import javax.swing.*;
@ -132,6 +133,17 @@ public class ActionFactory {
return createEditor(clazz, cellEditor); return createEditor(clazz, cellEditor);
} }
public static UpdateAction createAction(Class clazz) {
try {
Constructor<? extends UpdateAction> c = clazz.getDeclaredConstructor();
c.setAccessible(true);
return c.newInstance();
} catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e);
}
return null;
}
/** /**
* peter:从Action来产生ToolTipText. * peter:从Action来产生ToolTipText.
* *
@ -190,7 +202,7 @@ public class ActionFactory {
} }
if (jTemplate.acceptToolbarItem(clazz)) { if (jTemplate.acceptToolbarItem(clazz)) {
try { try {
Constructor<? extends UpdateAction> c = (Constructor<? extends UpdateAction>)clazz.getConstructor(cls); Constructor<? extends UpdateAction> c = (Constructor<? extends UpdateAction>) clazz.getConstructor(cls);
actions.add(c.newInstance(obj)); actions.add(c.newInstance(obj));
} catch (Exception e) { } catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e); FRContext.getLogger().error(e.getMessage(), e);
@ -200,6 +212,24 @@ public class ActionFactory {
return actions.toArray(new UpdateAction[actions.size()]); return actions.toArray(new UpdateAction[actions.size()]);
} }
public static MenuKeySet[] createCellInsertActionName() {
List<MenuKeySet> actionNames = new ArrayList<>();
for (Class<?> clazz : actionClasses) {
if (clazz == null) {
continue;
}
try {
Constructor<? extends UpdateAction> c = (Constructor<? extends UpdateAction>) clazz.getConstructor();
actionNames.add(c.newInstance().getMenuKeySet());
} catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e);
}
}
return actionNames.toArray(new MenuKeySet[actionNames.size()]);
}
/** /**
* 登记悬浮元素插入类型 * 登记悬浮元素插入类型
* *
@ -225,7 +255,7 @@ public class ActionFactory {
continue; continue;
} }
try { try {
Constructor<? extends UpdateAction> c = (Constructor<? extends UpdateAction>)clazz.getConstructor(cls); Constructor<? extends UpdateAction> c = (Constructor<? extends UpdateAction>) clazz.getConstructor(cls);
actions.add(c.newInstance(obj)); actions.add(c.newInstance(obj));
} catch (Exception e) { } catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e); FRContext.getLogger().error(e.getMessage(), e);

Loading…
Cancel
Save