Browse Source

REPORT-6949 条件属性的超级链接重命名后会自动生成超级链接

master
yaoh.wu 7 years ago
parent
commit
2eaeba9f96
  1. 34
      designer-base/src/com/fr/design/gui/frpane/HyperlinkGroupPane.java
  2. 14
      designer-base/src/com/fr/design/gui/frpane/HyperlinkGroupPaneActionProvider.java
  3. 47
      designer-form/src/com/fr/design/gui/xpane/FormHyperlinkGroupPane.java
  4. 36
      designer-realize/src/com/fr/design/mainframe/ElementCasePaneDelegate.java
  5. 5
      designer-realize/src/com/fr/design/mainframe/ReportHyperlinkGroupPaneNoPop.java

34
designer-base/src/com/fr/design/gui/frpane/HyperlinkGroupPane.java

@ -44,15 +44,12 @@ public abstract class HyperlinkGroupPane extends UIListControlPane {
@Override @Override
public void on(PluginEvent event) { public void on(PluginEvent event) {
refreshNameableCreator(createNameableCreators());
refreshNameableCreator(createNameableCreators());
} }
}, new PluginFilter() { }, new PluginFilter() {
@Override @Override
public boolean accept(PluginContext context) { public boolean accept(PluginContext context) {
return context.contain(HyperlinkProvider.XML_TAG); return context.contain(HyperlinkProvider.XML_TAG);
} }
}); });
@ -63,6 +60,7 @@ public abstract class HyperlinkGroupPane extends UIListControlPane {
* *
* @return 返回Nameable按钮数组. * @return 返回Nameable按钮数组.
*/ */
@Override
public NameableCreator[] createNameableCreators() { public NameableCreator[] createNameableCreators() {
Map<String, NameableCreator> nameCreators = new ListMap<>(); Map<String, NameableCreator> nameCreators = new ListMap<>();
NameableCreator[] creators = DesignModuleFactory.getHyperlinkGroupType().getHyperlinkCreators(); NameableCreator[] creators = DesignModuleFactory.getHyperlinkGroupType().getHyperlinkCreators();
@ -82,6 +80,7 @@ public abstract class HyperlinkGroupPane extends UIListControlPane {
* *
* @return 返回标题字符串. * @return 返回标题字符串.
*/ */
@Override
public String title4PopupWindow() { public String title4PopupWindow() {
return Inter.getLocText("FR-Designer_Hyperlink"); return Inter.getLocText("FR-Designer_Hyperlink");
} }
@ -91,11 +90,11 @@ public abstract class HyperlinkGroupPane extends UIListControlPane {
return Inter.getLocText("FR-Designer_Add_Hyperlink"); return Inter.getLocText("FR-Designer_Add_Hyperlink");
} }
public void populate(NameJavaScriptGroup nameHyperlink_array) { public void populate(NameJavaScriptGroup hyperlinkArray) {
java.util.List<NameObject> list = new ArrayList<NameObject>(); java.util.List<NameObject> list = new ArrayList<>();
if (nameHyperlink_array != null) { if (hyperlinkArray != null) {
for (int i = 0; i < nameHyperlink_array.size(); i++) { for (int i = 0; i < hyperlinkArray.size(); i++) {
list.add(new NameObject(nameHyperlink_array.getNameHyperlink(i).getName(), nameHyperlink_array.getNameHyperlink(i).getJavaScript())); list.add(new NameObject(hyperlinkArray.getNameHyperlink(i).getName(), hyperlinkArray.getNameHyperlink(i).getJavaScript()));
} }
} }
@ -113,20 +112,29 @@ public abstract class HyperlinkGroupPane extends UIListControlPane {
*/ */
public NameJavaScriptGroup updateJSGroup() { public NameJavaScriptGroup updateJSGroup() {
Nameable[] res = this.update(); Nameable[] res = this.update();
NameJavaScript[] res_array = new NameJavaScript[res.length]; NameJavaScript[] resArray = new NameJavaScript[res.length];
for (int i = 0; i < res.length; i++) { for (int i = 0; i < res.length; i++) {
NameObject no = (NameObject) res[i]; NameObject no = (NameObject) res[i];
res_array[i] = new NameJavaScript(no.getName(), (JavaScript) no.getObject()); resArray[i] = new NameJavaScript(no.getName(), (JavaScript) no.getObject());
} }
return new NameJavaScriptGroup(res_array); return new NameJavaScriptGroup(resArray);
} }
@Override @Override
public void saveSettings() { public void saveSettings() {
if (isPopulating) { if (isPopulating || !needAutoSave()) {
return; return;
} }
hyperlinkGroupPaneActionProvider.saveSettings(this); hyperlinkGroupPaneActionProvider.saveSettings(this);
} }
/**
* 是否需要自动保存到超级链接属性中
*
* @return 是否需要自动保存
*/
public boolean needAutoSave() {
return true;
}
} }

14
designer-base/src/com/fr/design/gui/frpane/HyperlinkGroupPaneActionProvider.java

@ -3,9 +3,23 @@ package com.fr.design.gui.frpane;
import com.fr.design.designer.TargetComponent; import com.fr.design.designer.TargetComponent;
/** /**
* @author plough
* Created by plough on 2017/7/26. * Created by plough on 2017/7/26.
*/ */
public interface HyperlinkGroupPaneActionProvider { public interface HyperlinkGroupPaneActionProvider {
/**
* 刷新面板展示
*
* @param hyperlinkGroupPane 超链面板
* @param elementCasePane 模板
*/
void populate(HyperlinkGroupPane hyperlinkGroupPane, TargetComponent elementCasePane); void populate(HyperlinkGroupPane hyperlinkGroupPane, TargetComponent elementCasePane);
/**
* 保存到文件
*
* @param hyperlinkGroupPane 超联面板
*/
void saveSettings(HyperlinkGroupPane hyperlinkGroupPane); void saveSettings(HyperlinkGroupPane hyperlinkGroupPane);
} }

47
designer-form/src/com/fr/design/gui/xpane/FormHyperlinkGroupPane.java

@ -1,42 +1,43 @@
package com.fr.design.gui.xpane; package com.fr.design.gui.xpane;
import com.fr.design.form.javascript.FormEmailPane;
import com.fr.design.gui.controlpane.NameObjectCreator; import com.fr.design.gui.controlpane.NameObjectCreator;
import com.fr.design.gui.controlpane.NameableCreator; import com.fr.design.gui.controlpane.NameableCreator;
import com.fr.design.gui.frpane.HyperlinkGroupPane; import com.fr.design.gui.frpane.HyperlinkGroupPane;
import com.fr.design.form.javascript.FormEmailPane;
import com.fr.design.gui.frpane.HyperlinkGroupPaneActionProvider; import com.fr.design.gui.frpane.HyperlinkGroupPaneActionProvider;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.js.EmailJavaScript; import com.fr.js.EmailJavaScript;
public class FormHyperlinkGroupPane extends HyperlinkGroupPane{ public class FormHyperlinkGroupPane extends HyperlinkGroupPane {
private static FormHyperlinkGroupPane singleton; private static FormHyperlinkGroupPane singleton;
protected FormHyperlinkGroupPane(HyperlinkGroupPaneActionProvider hyperlinkGroupPaneActionProvider) { protected FormHyperlinkGroupPane(HyperlinkGroupPaneActionProvider hyperlinkGroupPaneActionProvider) {
super(hyperlinkGroupPaneActionProvider); super(hyperlinkGroupPaneActionProvider);
} }
public synchronized static FormHyperlinkGroupPane getInstance(HyperlinkGroupPaneActionProvider hyperlinkGroupPaneActionProvider) { public synchronized static FormHyperlinkGroupPane getInstance(HyperlinkGroupPaneActionProvider hyperlinkGroupPaneActionProvider) {
if (singleton == null) { if (singleton == null) {
singleton = new FormHyperlinkGroupPane(hyperlinkGroupPaneActionProvider); singleton = new FormHyperlinkGroupPane(hyperlinkGroupPaneActionProvider);
} }
return singleton; return singleton;
} }
/** /**
* 生成添加按钮的NameableCreator * 生成添加按钮的NameableCreator
* 由于表单报表块的单元格超链和单元格条件属性超链中的emailPane都要用表单的emailPane这里调整下 * 由于表单报表块的单元格超链和单元格条件属性超链中的emailPane都要用表单的emailPane这里调整下
* *
* @return 返回Nameable按钮数组. * @return 返回Nameable按钮数组.
*/ */
public NameableCreator[] createNameableCreators() { @Override
NameableCreator[] creators = super.createNameableCreators(); public NameableCreator[] createNameableCreators() {
for (int i=0; i<creators.length; i++) { NameableCreator[] creators = super.createNameableCreators();
if (ComparatorUtils.equals(creators[i].menuName(), Inter.getLocText("FR-Designer_Email"))) { for (int i = 0; i < creators.length; i++) {
creators[i] = new NameObjectCreator(Inter.getLocText("FR-Designer_Email"), EmailJavaScript.class, FormEmailPane.class); if (ComparatorUtils.equals(creators[i].menuName(), Inter.getLocText("FR-Designer_Email"))) {
break; creators[i] = new NameObjectCreator(Inter.getLocText("FR-Designer_Email"), EmailJavaScript.class, FormEmailPane.class);
} break;
} }
return creators; }
} return creators;
}
} }

36
designer-realize/src/com/fr/design/mainframe/ElementCasePaneDelegate.java

@ -1,38 +1,42 @@
package com.fr.design.mainframe; package com.fr.design.mainframe;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.design.actions.edit.HyperlinkAction;
import com.fr.design.fun.MenuHandler;
import com.fr.design.gui.frpane.HyperlinkGroupPane;
import com.fr.design.menu.KeySetUtils;
import com.fr.design.present.ConditionAttributesGroupPane;
import com.fr.general.Inter;
import com.fr.grid.selection.FloatSelection;
import com.fr.grid.selection.Selection;
import com.fr.page.ReportSettingsProvider;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.DesignState; import com.fr.design.DesignState;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.actions.cell.*; import com.fr.design.actions.cell.CellAttributeAction;
import com.fr.design.actions.cell.CellExpandAttrAction;
import com.fr.design.actions.cell.CellWidgetAttrAction;
import com.fr.design.actions.cell.ConditionAttributesAction;
import com.fr.design.actions.cell.GlobalStyleMenuDef;
import com.fr.design.actions.columnrow.InsertColumnAction; import com.fr.design.actions.columnrow.InsertColumnAction;
import com.fr.design.actions.columnrow.InsertRowAction; import com.fr.design.actions.columnrow.InsertRowAction;
import com.fr.design.actions.core.ActionFactory; 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.MergeCellAction;
import com.fr.design.actions.edit.merge.UnmergeCellAction; import com.fr.design.actions.edit.merge.UnmergeCellAction;
import com.fr.design.actions.utils.DeprecatedActionManager; import com.fr.design.actions.utils.DeprecatedActionManager;
import com.fr.design.event.TargetModifiedEvent; import com.fr.design.event.TargetModifiedEvent;
import com.fr.design.event.TargetModifiedListener; 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.mainframe.cell.QuickEditorRegion;
import com.fr.design.menu.KeySetUtils;
import com.fr.design.menu.MenuDef; import com.fr.design.menu.MenuDef;
import com.fr.design.menu.SeparatorDef; import com.fr.design.menu.SeparatorDef;
import com.fr.report.worksheet.WorkSheet; import com.fr.design.present.ConditionAttributesGroupPane;
import com.fr.design.roleAuthority.RolesAlreadyEditedPane; import com.fr.design.roleAuthority.RolesAlreadyEditedPane;
import com.fr.design.selection.SelectionEvent; import com.fr.design.selection.SelectionEvent;
import com.fr.design.selection.SelectionListener; import com.fr.design.selection.SelectionListener;
import com.fr.general.Inter;
import com.fr.grid.selection.FloatSelection;
import com.fr.grid.selection.Selection;
import com.fr.page.ReportSettingsProvider;
import com.fr.report.worksheet.WorkSheet;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import javax.swing.*; import javax.swing.JPanel;
import java.awt.*; import java.awt.BorderLayout;
/** /**
* 类说明: 设计面板中最上方的"插入" "单元格"下拉列表Menu模块. * 类说明: 设计面板中最上方的"插入" "单元格"下拉列表Menu模块.
@ -81,11 +85,11 @@ public class ElementCasePaneDelegate extends ElementCasePane<WorkSheet> {
CellElementPropertyPane.getInstance().populate(ElementCasePaneDelegate.this); CellElementPropertyPane.getInstance().populate(ElementCasePaneDelegate.this);
QuickEditorRegion.getInstance().populate(getCurrentEditor()); QuickEditorRegion.getInstance().populate(getCurrentEditor());
JTemplate editingTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); JTemplate editingTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
// 模板初始化完成后,才能初始化超级链接面板
if (editingTemplate != null && !editingTemplate.isUpMode()) { if (editingTemplate != null && !editingTemplate.isUpMode()) {
Selection editingSelection = getSelection(); Selection editingSelection = getSelection();
// 模板初始化完成后,才能初始化超级链接面板 // 获取超级链接面板并刷新显示
HyperlinkGroupPane hyperlinkGroupPane = editingTemplate.getHyperLinkPane(HyperlinkGroupPaneActionImpl.getInstance()); HyperlinkGroupPane hyperlinkGroupPane = editingTemplate.getHyperLinkPane(HyperlinkGroupPaneActionImpl.getInstance());
hyperlinkGroupPane.populate(ElementCasePaneDelegate.this);
if (editingSelection instanceof FloatSelection) { if (editingSelection instanceof FloatSelection) {
EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.REPORT_FLOAT); EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.REPORT_FLOAT);
JPanel floatPane = new JPanel(new BorderLayout()); JPanel floatPane = new JPanel(new BorderLayout());

5
designer-realize/src/com/fr/design/mainframe/ReportHyperlinkGroupPaneNoPop.java

@ -24,4 +24,9 @@ public class ReportHyperlinkGroupPaneNoPop extends ReportHyperlinkGroupPane{
protected boolean isNewStyle() { protected boolean isNewStyle() {
return false; return false;
} }
@Override
public boolean needAutoSave() {
return false;
}
} }

Loading…
Cancel
Save