diff --git a/designer/src/com/fr/design/actions/insert/flot/FormulaFloatAction.java b/designer/src/com/fr/design/actions/insert/flot/FormulaFloatAction.java index 82536e887a..4e2a7cbb02 100644 --- a/designer/src/com/fr/design/actions/insert/flot/FormulaFloatAction.java +++ b/designer/src/com/fr/design/actions/insert/flot/FormulaFloatAction.java @@ -6,24 +6,39 @@ 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.actions.ElementCaseAction; +import com.fr.design.dialog.BasicDialog; +import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.file.HistoryTemplateListPane; +import com.fr.design.formula.FormulaFactory; +import com.fr.design.formula.UIFormula; +import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.ElementCasePane; import com.fr.design.menu.MenuKeySet; +import com.fr.design.report.SelectImagePane; 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.cell.cellattr.CellImage; import com.fr.report.elementcase.TemplateElementCase; +import com.fr.stable.CoreGraphHelper; +import com.fr.stable.StringUtils; import com.fr.stable.unit.FU; import javax.swing.*; +import java.awt.*; import java.awt.event.ActionEvent; +import java.io.File; /** * Insert formula. */ -public class FormulaFloatAction extends AbstractShapeAction { +public class FormulaFloatAction extends ElementCaseAction { + + private boolean returnValue = false; + public FormulaFloatAction(ElementCasePane t) { super(t); this.setMenuKeySet(FLOAT_INSERT_FORMULA); @@ -49,23 +64,6 @@ public class FormulaFloatAction extends AbstractShapeAction { } }; - /** - * 动作 - * - * @param e 事件 - */ - public void actionPerformed(ActionEvent e) { - ElementCasePane jws = getEditingComponent(); - if (jws == null) { - return; - } - // - 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(); @@ -95,4 +93,43 @@ public class FormulaFloatAction extends AbstractShapeAction { reportPane.setSelection(new FloatSelection(grid.getDrawingFloatElement().getName())); } + /** + * 执行动作 + * + * @return 成功返回true + */ + @Override + public boolean executeActionReturnUndoRecordNeeded() { + final ElementCasePane reportPane = (ElementCasePane) HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getCurrentElementCasePane(); + if (reportPane == null) { + return false; + } + + reportPane.stopEditing(); + final FloatElement floatElement = new FloatElement(); + final UIFormula formulaPane = FormulaFactory.createFormulaPane(); + formulaPane.populate(new Formula(StringUtils.EMPTY)); + + BasicDialog dialog = formulaPane.showLargeWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { + + @Override + public void doOk() { + floatElement.setValue(formulaPane.update()); + if (reportPane == null) { + return; + } + reportPane.getGrid().setDrawingFloatElement(floatElement); + doWithDrawingFloatElement(); + returnValue = true; + } + + @Override + public void doCancel() { + returnValue = false; + } + }); + dialog.setVisible(true); + return returnValue; + } + } \ No newline at end of file diff --git a/designer/src/com/fr/design/actions/insert/flot/TextBoxFloatAction.java b/designer/src/com/fr/design/actions/insert/flot/TextBoxFloatAction.java index 9548db51c3..6001e2e72b 100644 --- a/designer/src/com/fr/design/actions/insert/flot/TextBoxFloatAction.java +++ b/designer/src/com/fr/design/actions/insert/flot/TextBoxFloatAction.java @@ -54,6 +54,7 @@ public class TextBoxFloatAction extends AbstractShapeAction { * * @param e 动作 */ + @Override public void actionPerformed(ActionEvent e) { ElementCasePane jws = getEditingComponent(); if (jws == null) { @@ -67,7 +68,7 @@ public class TextBoxFloatAction extends AbstractShapeAction { private void doWithDrawingFloatElement() { ElementCasePane jws = (ElementCasePane) HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getCurrentElementCasePane(); - ; + Grid grid = jws.getGrid(); ElementCasePane reportPane = grid.getElementCasePane(); @@ -93,5 +94,6 @@ public class TextBoxFloatAction extends AbstractShapeAction { report.addFloatElement(grid.getDrawingFloatElement()); reportPane.setSelection(new FloatSelection(grid.getDrawingFloatElement().getName())); + reportPane.fireTargetModified(); } } \ No newline at end of file diff --git a/designer/src/com/fr/design/mainframe/AuthorityToolBarPane.java b/designer/src/com/fr/design/mainframe/AuthorityToolBarPane.java index 79e52bfe14..23e4622e1d 100644 --- a/designer/src/com/fr/design/mainframe/AuthorityToolBarPane.java +++ b/designer/src/com/fr/design/mainframe/AuthorityToolBarPane.java @@ -238,7 +238,6 @@ public class AuthorityToolBarPane extends BasicBeanPane { HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().setJTemplateResolution(resolution); polyDezi.updateUI(); } - HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().fireTargetModified(); } @Override diff --git a/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java b/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java index e9d2ba784a..e35d0c0568 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java +++ b/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java @@ -670,6 +670,8 @@ public class AlphaFineDialog extends UIDialog { searchTextField.setText(null); removeSearchResult(); } + } else if (e.getKeyCode() == KeyEvent.VK_ENTER) { + dealWithSearchResult(searchResultList.getSelectedValue()); } } }); @@ -694,6 +696,15 @@ public class AlphaFineDialog extends UIDialog { } + /** + * 处理搜索结果 + * @param selectedValue + */ + private void dealWithSearchResult(AlphaCellModel selectedValue) { + doNavigate(); + saveLocalHistory(selectedValue); + } + /** * 当鼠标在搜索界面边界外点击时触发 */ @@ -725,6 +736,9 @@ public class AlphaFineDialog extends UIDialog { //不处理 } + /** + * 导航到结果页面 + */ private void doNavigate() { AlphaFineDialog.this.dispose(); final AlphaCellModel model = searchResultList.getSelectedValue(); @@ -732,15 +746,15 @@ public class AlphaFineDialog extends UIDialog { } /** - * 保存本地(本地常用) + * 保存结果到本地(本地常用) * * @param cellModel */ - private void saveHistory(AlphaCellModel cellModel) { + private void saveLocalHistory(AlphaCellModel cellModel) { RecentSearchManager recentSearchManager = RecentSearchManager.getRecentSearchManger(); recentSearchManager.addRecentModel(storeText, cellModel); recentSearchManager.saveXMLFile(); - sendToServer(storeText, cellModel); + sendDataToServer(storeText, cellModel); } @@ -750,7 +764,7 @@ public class AlphaFineDialog extends UIDialog { * @param searchKey * @param cellModel */ - private void sendToServer(String searchKey, AlphaCellModel cellModel) { + private void sendDataToServer(String searchKey, AlphaCellModel cellModel) { if (cellModel.isNeedToSendToServer()) { String username = ConfigManager.getProviderInstance().getBbsUsername(); String uuid = DesignerEnvManager.getEnvManager().getUUID(); @@ -908,8 +922,7 @@ public class AlphaFineDialog extends UIDialog { @Override public void keyPressed(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_ENTER) { - doNavigate(); - saveHistory(getSelectedValue()); + dealWithSearchResult(getSelectedValue()); } else if (e.getKeyCode() == KeyEvent.VK_UP) { if (getSelectedIndex() == 1) { searchTextField.requestFocus(); @@ -926,8 +939,7 @@ public class AlphaFineDialog extends UIDialog { int selectedIndex = getSelectedIndex(); AlphaCellModel selectedValue = getSelectedValue(); if (e.getClickCount() == 2 && selectedValue.hasAction()) { - doNavigate(); - saveHistory(selectedValue); + dealWithSearchResult(selectedValue); } else if (e.getClickCount() == 1) { if (selectedValue instanceof MoreModel && ((MoreModel) selectedValue).isNeedMore()) { dealWithMoreOrLessResult(selectedIndex, (MoreModel) selectedValue); diff --git a/designer/src/com/fr/design/mainframe/alphafine/images/bigloading.gif b/designer/src/com/fr/design/mainframe/alphafine/images/bigloading.gif index 715ab7aecc..ab4d295f0f 100644 Binary files a/designer/src/com/fr/design/mainframe/alphafine/images/bigloading.gif and b/designer/src/com/fr/design/mainframe/alphafine/images/bigloading.gif differ diff --git a/designer/src/com/fr/design/mainframe/alphafine/search/manager/RecommendSearchManager.java b/designer/src/com/fr/design/mainframe/alphafine/search/manager/RecommendSearchManager.java index 176a24b249..6c741bd3dd 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/search/manager/RecommendSearchManager.java +++ b/designer/src/com/fr/design/mainframe/alphafine/search/manager/RecommendSearchManager.java @@ -16,6 +16,7 @@ import com.fr.json.JSONArray; import com.fr.json.JSONException; import com.fr.json.JSONObject; import com.fr.stable.CodeUtils; +import com.fr.stable.StringUtils; import java.util.Iterator; import java.util.List; @@ -37,6 +38,7 @@ public class RecommendSearchManager implements AlphaFineSearchProcessor { @Override public synchronized SearchResult getLessSearchResult(String searchText) { + searchText = searchText.replaceAll(StringUtils.BLANK, StringUtils.EMPTY); this.modelList = new SearchResult(); this.recommendModelList = new SearchResult(); if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isContainRecommend()) { diff --git a/designer/src/com/fr/design/mainframe/cell/settingpane/style/CustomStylePane.java b/designer/src/com/fr/design/mainframe/cell/settingpane/style/CustomStylePane.java index e12e8dacdc..06b8cb937b 100644 --- a/designer/src/com/fr/design/mainframe/cell/settingpane/style/CustomStylePane.java +++ b/designer/src/com/fr/design/mainframe/cell/settingpane/style/CustomStylePane.java @@ -6,15 +6,12 @@ import com.fr.base.Style; import com.fr.design.actions.utils.ReportActionUtils; import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.MultiTabPane; -import com.fr.design.gui.ibutton.FiveButtonLayout; import com.fr.design.gui.style.*; import com.fr.design.mainframe.ElementCasePane; import com.fr.design.style.BorderUtils; -import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.Inter; import com.fr.stable.Constants; -import javax.swing.*; import javax.swing.event.ChangeListener; import java.awt.*; import java.util.ArrayList; @@ -41,7 +38,7 @@ public class CustomStylePane extends MultiTabPane