diff --git a/designer/src/com/fr/design/actions/CellSelectionAction.java b/designer/src/com/fr/design/actions/CellSelectionAction.java index 8ca67feafc..16bf089c55 100644 --- a/designer/src/com/fr/design/actions/CellSelectionAction.java +++ b/designer/src/com/fr/design/actions/CellSelectionAction.java @@ -5,30 +5,33 @@ import com.fr.grid.selection.CellSelection; import com.fr.grid.selection.Selection; public abstract class CellSelectionAction extends ElementCaseAction { - protected CellSelectionAction(ElementCasePane t) { - super(t); - } - - @Override - public boolean executeActionReturnUndoRecordNeeded() { - ElementCasePane ePane = this.getEditingComponent(); - Selection s = ePane.getSelection(); - - // TODO ALEX_SEP instanceof i hate it - if (s instanceof CellSelection) { - return executeActionReturnUndoRecordNeededWithCellSelection((CellSelection)s); - } - - return false; - } - - protected abstract boolean executeActionReturnUndoRecordNeededWithCellSelection(CellSelection cs); - - @Override - public void update() { - super.update(); - if (this.isEnabled()) { - this.setEnabled(this.getEditingComponent().getSelection() instanceof CellSelection); - } - } + protected CellSelectionAction() { + } + + protected CellSelectionAction(ElementCasePane t) { + super(t); + } + + @Override + public boolean executeActionReturnUndoRecordNeeded() { + ElementCasePane ePane = this.getEditingComponent(); + Selection s = ePane.getSelection(); + + // TODO ALEX_SEP instanceof i hate it + if (s instanceof CellSelection) { + return executeActionReturnUndoRecordNeededWithCellSelection((CellSelection) s); + } + + return false; + } + + protected abstract boolean executeActionReturnUndoRecordNeededWithCellSelection(CellSelection cs); + + @Override + public void update() { + super.update(); + if (this.isEnabled()) { + this.setEnabled(this.getEditingComponent().getSelection() instanceof CellSelection); + } + } } \ No newline at end of file diff --git a/designer/src/com/fr/design/actions/ElementCaseAction.java b/designer/src/com/fr/design/actions/ElementCaseAction.java index bfc0c8b4e5..09b7848306 100644 --- a/designer/src/com/fr/design/actions/ElementCaseAction.java +++ b/designer/src/com/fr/design/actions/ElementCaseAction.java @@ -3,17 +3,15 @@ package com.fr.design.actions; //ElementCaseAction应该有GridSelectionChangeListener,就从悬浮元素和单元格来讲,就必须有了,用来判断这些ElementCaseAction是否可以编辑,当然还可以做些其他事情 // -import com.fr.design.mainframe.DesignerContext; 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 { - protected ElementCaseAction(ElementCasePane t) { - super(t); - t.addSelectionChangeListener(createSelectionListener()); - } + protected ElementCaseAction() { + } + + protected ElementCaseAction(ElementCasePane t) { + super(t); + t.addSelectionChangeListener(createSelectionListener()); + } } \ No newline at end of file diff --git a/designer/src/com/fr/design/actions/SelectionListenerAction.java b/designer/src/com/fr/design/actions/SelectionListenerAction.java index 48cd2d4f9a..d150460ec7 100644 --- a/designer/src/com/fr/design/actions/SelectionListenerAction.java +++ b/designer/src/com/fr/design/actions/SelectionListenerAction.java @@ -12,11 +12,14 @@ import com.fr.grid.selection.Selection; */ public abstract class SelectionListenerAction extends TemplateComponentAction { + protected SelectionListenerAction() { + } + protected SelectionListenerAction(ElementCasePane elementCasePane) { super(elementCasePane); } - protected SelectionListener createSelectionListener () { + protected SelectionListener createSelectionListener() { return new SelectionListener() { @Override diff --git a/designer/src/com/fr/design/actions/insert/cell/AbstractCellAction.java b/designer/src/com/fr/design/actions/insert/cell/AbstractCellAction.java index a8c9ab80fe..1127acf538 100644 --- a/designer/src/com/fr/design/actions/insert/cell/AbstractCellAction.java +++ b/designer/src/com/fr/design/actions/insert/cell/AbstractCellAction.java @@ -13,12 +13,15 @@ import com.fr.report.elementcase.TemplateElementCase; * Cell. */ public abstract class AbstractCellAction extends CellSelectionAction { - protected AbstractCellAction(ElementCasePane t) { - super(t); - } - + protected AbstractCellAction() { + } + + protected AbstractCellAction(ElementCasePane t) { + super(t); + } + public abstract Class getCellValueClass(); - + /* * TODO ALEX_SEP 这里的返回boolean量表示模板是否改变,导致很多很多的方法的boolean返回值都是这个意思 * @@ -26,8 +29,8 @@ public abstract class AbstractCellAction extends CellSelectionAction { */ @Override protected boolean executeActionReturnUndoRecordNeededWithCellSelection( - CellSelection cs) { - ElementCasePane ePane = this.getEditingComponent(); + CellSelection cs) { + ElementCasePane ePane = this.getEditingComponent(); //got simple cell element from column and row. TemplateElementCase report = ePane.getEditingElementCase(); @@ -35,17 +38,18 @@ public abstract class AbstractCellAction extends CellSelectionAction { if (report != null && this instanceof DSColumnCellAction) { SheetUtils.calculateDefaultParent(report); } - + return ePane.getGrid().startCellEditingAt_DEC( - cs.getColumn(), - cs.getRow(), - this.getCellValueClass(), false + cs.getColumn(), + cs.getRow(), + this.getCellValueClass(), false ); } - @Override - public void update() { - super.update(); - ElementCasePane ePane = this.getEditingComponent(); - this.setEnabled(ePane.isSelectedOneCell()); - } + + @Override + public void update() { + super.update(); + ElementCasePane ePane = this.getEditingComponent(); + this.setEnabled(ePane.isSelectedOneCell()); + } } \ No newline at end of file diff --git a/designer/src/com/fr/design/actions/insert/cell/BiasCellAction.java b/designer/src/com/fr/design/actions/insert/cell/BiasCellAction.java index e3821f299d..9fc6162881 100644 --- a/designer/src/com/fr/design/actions/insert/cell/BiasCellAction.java +++ b/designer/src/com/fr/design/actions/insert/cell/BiasCellAction.java @@ -3,8 +3,6 @@ */ package com.fr.design.actions.insert.cell; -import javax.swing.KeyStroke; - import com.fr.base.BaseUtils; import com.fr.design.actions.core.WorkBookSupportable; import com.fr.design.mainframe.ElementCasePane; @@ -12,12 +10,23 @@ import com.fr.design.menu.MenuKeySet; import com.fr.general.Inter; import com.fr.report.cell.painter.BiasTextPainter; +import javax.swing.KeyStroke; + /** * Bias */ public class BiasCellAction extends AbstractCellAction implements WorkBookSupportable { - public BiasCellAction(ElementCasePane t) { - super(t); + + public BiasCellAction() { + initAction(); + } + + public BiasCellAction(ElementCasePane t) { + super(t); + initAction(); + } + + private void initAction() { this.setMenuKeySet(INSERT_SLOPE_LINE); this.setName(getMenuKeySet().getMenuKeySetName()+ "..."); this.setMnemonic(getMenuKeySet().getMnemonic()); diff --git a/designer/src/com/fr/design/actions/insert/cell/ChartCellAction.java b/designer/src/com/fr/design/actions/insert/cell/ChartCellAction.java index 8f12d287b2..83d8f238ee 100644 --- a/designer/src/com/fr/design/actions/insert/cell/ChartCellAction.java +++ b/designer/src/com/fr/design/actions/insert/cell/ChartCellAction.java @@ -16,11 +16,19 @@ import javax.swing.*; * . */ public class ChartCellAction extends AbstractCellAction implements WorkBookSupportable { + public ChartCellAction(){ + initAction(); + } + public ChartCellAction(ElementCasePane t) { super(t); - this.setMenuKeySet(INSERT_CHART); - this.setName(getMenuKeySet().getMenuKeySetName()+ "..."); - this.setMnemonic(getMenuKeySet().getMnemonic()); + initAction(); + } + + private void initAction() { + this.setMenuKeySet(INSERT_CHART); + this.setName(getMenuKeySet().getMenuKeySetName()+ "..."); + this.setMnemonic(getMenuKeySet().getMnemonic()); this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_insert/chart.png")); } diff --git a/designer/src/com/fr/design/actions/insert/cell/DSColumnCellAction.java b/designer/src/com/fr/design/actions/insert/cell/DSColumnCellAction.java index 90d0ccb8bc..7afd7b4ef7 100644 --- a/designer/src/com/fr/design/actions/insert/cell/DSColumnCellAction.java +++ b/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; public class DSColumnCellAction extends AbstractCellAction implements WorkBookSupportable { - public DSColumnCellAction(ElementCasePane t) { - super(t); + public DSColumnCellAction() { + initAction(); + } + + public DSColumnCellAction(ElementCasePane t) { + super(t); + initAction(); + this.setSearchText(new DSColumnPane()); + } + + private void initAction() { this.setMenuKeySet(KeySetUtils.INSERT_DATA_COLUMN); - this.setName(getMenuKeySet().getMenuKeySetName()+ "..."); + this.setName(getMenuKeySet().getMenuKeySetName() + "..."); this.setMnemonic(getMenuKeySet().getMnemonic()); this.setSmallIcon(IOUtils.readIcon("/com/fr/design/images/m_insert/bindColumn.png")); - this.setSearchText(new DSColumnPane()); } @Override diff --git a/designer/src/com/fr/design/actions/insert/cell/FormulaCellAction.java b/designer/src/com/fr/design/actions/insert/cell/FormulaCellAction.java index 92757d88e0..499b9119df 100644 --- a/designer/src/com/fr/design/actions/insert/cell/FormulaCellAction.java +++ b/designer/src/com/fr/design/actions/insert/cell/FormulaCellAction.java @@ -13,10 +13,18 @@ import com.fr.general.Inter; import javax.swing.*; public class FormulaCellAction extends AbstractCellAction implements WorkBookSupportable { - public FormulaCellAction(ElementCasePane t) { - super(t); + public FormulaCellAction() { + initAction(); + } + + public FormulaCellAction(ElementCasePane t) { + super(t); + initAction(); + } + + private void initAction() { this.setMenuKeySet(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")); } @@ -39,7 +47,7 @@ public class FormulaCellAction extends AbstractCellAction implements WorkBookSup }; @Override - public Class getCellValueClass() { + public Class getCellValueClass() { return Formula.class; } } \ No newline at end of file diff --git a/designer/src/com/fr/design/actions/insert/cell/GeneralCellAction.java b/designer/src/com/fr/design/actions/insert/cell/GeneralCellAction.java index 7146924673..40aef3198c 100644 --- a/designer/src/com/fr/design/actions/insert/cell/GeneralCellAction.java +++ b/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 GeneralCellAction(ElementCasePane t) { - super(t); + public GeneralCellAction() { + initAction(); + } + + public GeneralCellAction(ElementCasePane t) { + super(t); + initAction(); + } + + private void initAction() { this.setMenuKeySet(INSERT_TEXT); - this.setName(getMenuKeySet().getMenuKeySetName()+ "..."); + this.setName(getMenuKeySet().getMenuKeySetName() + "..."); this.setMnemonic(getMenuKeySet().getMnemonic()); this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_insert/text.png")); } @@ -41,7 +49,7 @@ public class GeneralCellAction extends AbstractCellAction implements WorkBookSup }; @Override - public Class getCellValueClass() { + public Class getCellValueClass() { return String.class; } } \ No newline at end of file diff --git a/designer/src/com/fr/design/actions/insert/cell/ImageCellAction.java b/designer/src/com/fr/design/actions/insert/cell/ImageCellAction.java index 594cb771be..e3761909a9 100644 --- a/designer/src/com/fr/design/actions/insert/cell/ImageCellAction.java +++ b/designer/src/com/fr/design/actions/insert/cell/ImageCellAction.java @@ -16,10 +16,18 @@ import java.awt.*; * Image */ public class ImageCellAction extends AbstractCellAction implements WorkBookSupportable { - public ImageCellAction(ElementCasePane t) { - super(t); + public ImageCellAction() { + initAction(); + } + + public ImageCellAction(ElementCasePane t) { + super(t); + initAction(); + } + + private void initAction() { this.setMenuKeySet(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")); } @@ -42,7 +50,7 @@ public class ImageCellAction extends AbstractCellAction implements WorkBookSuppo }; @Override - public Class getCellValueClass() { + public Class getCellValueClass() { return Image.class; } } \ No newline at end of file diff --git a/designer/src/com/fr/design/actions/insert/cell/RichTextCellAction.java b/designer/src/com/fr/design/actions/insert/cell/RichTextCellAction.java index c8017099f4..c9df15162b 100644 --- a/designer/src/com/fr/design/actions/insert/cell/RichTextCellAction.java +++ b/designer/src/com/fr/design/actions/insert/cell/RichTextCellAction.java @@ -1,7 +1,5 @@ package com.fr.design.actions.insert.cell; -import javax.swing.KeyStroke; - import com.fr.base.BaseUtils; import com.fr.design.actions.core.WorkBookSupportable; import com.fr.design.mainframe.ElementCasePane; @@ -10,53 +8,64 @@ import com.fr.general.ComparatorUtils; import com.fr.general.Inter; import com.fr.report.cell.cellattr.core.RichText; +import javax.swing.KeyStroke; + public class RichTextCellAction extends AbstractCellAction implements WorkBookSupportable { - public RichTextCellAction(ElementCasePane t) { - super(t); + public RichTextCellAction() { + initAction(); + } + + public RichTextCellAction(ElementCasePane t) { + super(t); + initAction(); + } + + private void initAction() { this.setMenuKeySet(INSERT_RICHTEXT); - this.setName(getMenuKeySet().getMenuKeySetName()+ "..."); + this.setName(getMenuKeySet().getMenuKeySetName() + "..."); this.setMnemonic(getMenuKeySet().getMnemonic()); this.setSmallIcon(BaseUtils.readIcon( "/com/fr/design/images/m_insert/richtext.png")); - } - - @Override - public Class getCellValueClass() { - return RichText.class; - } - - /** - * equals 比较 - * @param object - * @return true false - */ - @Override - public boolean equals(Object object) { - if (this == object){ - return true; - } - if (!(object instanceof RichTextCellAction)){ - return false; - } - - return ComparatorUtils.equals(this.getEditingComponent(),((RichTextCellAction)object).getEditingComponent()); - } + } + + @Override + public Class getCellValueClass() { + return RichText.class; + } + + /** + * equals 比较 + * + * @param object + * @return true false + */ + @Override + public boolean equals(Object object) { + if (this == object) { + return true; + } + if (!(object instanceof RichTextCellAction)) { + return false; + } + + return ComparatorUtils.equals(this.getEditingComponent(), ((RichTextCellAction) object).getEditingComponent()); + } private static final MenuKeySet INSERT_RICHTEXT = new MenuKeySet() { - @Override - public char getMnemonic() { - return 'R'; - } - - @Override - public String getMenuName() { - return Inter.getLocText("FR-Designer_RichText"); - } - - @Override - public KeyStroke getKeyStroke() { - return null; - } + @Override + public char getMnemonic() { + return 'R'; + } + + @Override + public String getMenuName() { + return Inter.getLocText("FR-Designer_RichText"); + } + + @Override + public KeyStroke getKeyStroke() { + return null; + } }; } \ No newline at end of file diff --git a/designer/src/com/fr/design/actions/insert/cell/SubReportCellAction.java b/designer/src/com/fr/design/actions/insert/cell/SubReportCellAction.java index 79dc6c6421..a055bcd0d0 100644 --- a/designer/src/com/fr/design/actions/insert/cell/SubReportCellAction.java +++ b/designer/src/com/fr/design/actions/insert/cell/SubReportCellAction.java @@ -1,7 +1,5 @@ package com.fr.design.actions.insert.cell; -import javax.swing.KeyStroke; - import com.fr.base.BaseUtils; import com.fr.design.mainframe.ElementCasePane; import com.fr.design.menu.MenuKeySet; @@ -9,54 +7,65 @@ import com.fr.general.ComparatorUtils; import com.fr.general.Inter; import com.fr.report.cell.cellattr.core.SubReport; +import javax.swing.KeyStroke; + public class SubReportCellAction extends AbstractCellAction { - public SubReportCellAction(ElementCasePane t) { - super(t); + public SubReportCellAction() { + initAction(); + } + + public SubReportCellAction(ElementCasePane t) { + super(t); + initAction(); + } + + private void initAction() { this.setMenuKeySet(INSERT_SUB_REPORT); - this.setName(getMenuKeySet().getMenuKeySetName()+ "..."); + this.setName(getMenuKeySet().getMenuKeySetName() + "..."); this.setMnemonic(getMenuKeySet().getMnemonic()); this.setSmallIcon(BaseUtils.readIcon( "/com/fr/design/images/m_insert/subReport.png")); - } - - public static final MenuKeySet INSERT_SUB_REPORT = new MenuKeySet() { - @Override - public char getMnemonic() { - return 'S'; - } - - @Override - public String getMenuName() { - return Inter.getLocText("M_Insert-Sub_Report"); - } - - @Override - public KeyStroke getKeyStroke() { - return null; - } - }; - - /** - * equals 比较 - * @param object - * @return true false - */ - @Override - public boolean equals(Object object) { - if (this == object){ - return true; - } - if (!(object instanceof SubReportCellAction)){ - return false; - } - - return ComparatorUtils.equals(this.getEditingComponent(),((SubReportCellAction)object).getEditingComponent()); - } - - @Override - public Class getCellValueClass() { - return SubReport.class; - } + } + + public static final MenuKeySet INSERT_SUB_REPORT = new MenuKeySet() { + @Override + public char getMnemonic() { + return 'S'; + } + + @Override + public String getMenuName() { + return Inter.getLocText("M_Insert-Sub_Report"); + } + + @Override + public KeyStroke getKeyStroke() { + return null; + } + }; + + /** + * equals 比较 + * + * @param object + * @return true false + */ + @Override + public boolean equals(Object object) { + if (this == object) { + return true; + } + if (!(object instanceof SubReportCellAction)) { + return false; + } + + return ComparatorUtils.equals(this.getEditingComponent(), ((SubReportCellAction) object).getEditingComponent()); + } + + @Override + public Class getCellValueClass() { + return SubReport.class; + } } \ No newline at end of file diff --git a/designer/src/com/fr/design/dscolumn/SelectedDataColumnPane.java b/designer/src/com/fr/design/dscolumn/SelectedDataColumnPane.java index 682f9a930d..f76d5fa85a 100644 --- a/designer/src/com/fr/design/dscolumn/SelectedDataColumnPane.java +++ b/designer/src/com/fr/design/dscolumn/SelectedDataColumnPane.java @@ -279,8 +279,8 @@ public class SelectedDataColumnPane extends BasicPane { }); } - private void initWithParameterButton(ElementCasePane casePane, TemplateCellElement cellElement) { - SelectedDataColumnPane that = this; + private void initWithParameterButton(final ElementCasePane casePane, final TemplateCellElement cellElement) { + final SelectedDataColumnPane that = this; editorPane = new UITableEditorPane(new ParameterTableModel()); paramButton = new UIButton(Inter.getLocText("TableData_Dynamic_Parameter_Setting")); paramButton.addActionListener(new ActionListener() { diff --git a/designer/src/com/fr/design/mainframe/CellWidgetPropertyPane.java b/designer/src/com/fr/design/mainframe/CellWidgetPropertyPane.java index df2cbca539..5637a68ca6 100644 --- a/designer/src/com/fr/design/mainframe/CellWidgetPropertyPane.java +++ b/designer/src/com/fr/design/mainframe/CellWidgetPropertyPane.java @@ -69,9 +69,6 @@ public class CellWidgetPropertyPane extends BasicPane { Widget cellWidget = cellElement.getWidget(); - if(cellWidget == null){ - return; - } // 这里进行克隆的原因是为了保留原始的Widget以便和新的Widget做比较来判断是否发生了改变 if (cellWidget != null) { diff --git a/designer/src/com/fr/design/module/DesignerModule.java b/designer/src/com/fr/design/module/DesignerModule.java index bf96db2af2..6cdbea4e5d 100644 --- a/designer/src/com/fr/design/module/DesignerModule.java +++ b/designer/src/com/fr/design/module/DesignerModule.java @@ -169,7 +169,7 @@ public class DesignerModule extends DesignModule { } @Override - /** + /* * 针对不同的对象,在读取Object对象的xml的时候需要使用不同的对象生成器 * @return 返回对象生成器 */ @@ -242,7 +242,7 @@ public class DesignerModule extends DesignModule { } @Override - /** + /* * 返回设计器能打开的模板类型的一个数组列表 * @return 可以打开的模板类型的数组 */ diff --git a/designer/src/com/fr/design/widget/WidgetPane.java b/designer/src/com/fr/design/widget/WidgetPane.java index f26b1a19a4..c4ce0f5638 100644 --- a/designer/src/com/fr/design/widget/WidgetPane.java +++ b/designer/src/com/fr/design/widget/WidgetPane.java @@ -120,6 +120,7 @@ public class WidgetPane extends AbstractAttrNoScrollPane implements ItemListener public void populate(Widget widget) { if (widget == null) { + editorTypeComboBox.setSelectedIndex(-1); return; } diff --git a/designer/src/com/fr/design/widget/ui/ButtonDefinePane.java b/designer/src/com/fr/design/widget/ui/ButtonDefinePane.java index b53e003e60..fcb3f2dcc6 100644 --- a/designer/src/com/fr/design/widget/ui/ButtonDefinePane.java +++ b/designer/src/com/fr/design/widget/ui/ButtonDefinePane.java @@ -20,7 +20,6 @@ public class ButtonDefinePane extends AbstractDataModify