Browse Source

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

master
yaoh.wu 7 years ago
parent
commit
2eaeba9f96
  1. 32
      designer-base/src/com/fr/design/gui/frpane/HyperlinkGroupPane.java
  2. 14
      designer-base/src/com/fr/design/gui/frpane/HyperlinkGroupPaneActionProvider.java
  3. 7
      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

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

@ -44,15 +44,12 @@ public abstract class HyperlinkGroupPane extends UIListControlPane {
@Override
public void on(PluginEvent event) {
refreshNameableCreator(createNameableCreators());
}
}, new PluginFilter() {
@Override
public boolean accept(PluginContext context) {
return context.contain(HyperlinkProvider.XML_TAG);
}
});
@ -63,6 +60,7 @@ public abstract class HyperlinkGroupPane extends UIListControlPane {
*
* @return 返回Nameable按钮数组.
*/
@Override
public NameableCreator[] createNameableCreators() {
Map<String, NameableCreator> nameCreators = new ListMap<>();
NameableCreator[] creators = DesignModuleFactory.getHyperlinkGroupType().getHyperlinkCreators();
@ -82,6 +80,7 @@ public abstract class HyperlinkGroupPane extends UIListControlPane {
*
* @return 返回标题字符串.
*/
@Override
public String title4PopupWindow() {
return Inter.getLocText("FR-Designer_Hyperlink");
}
@ -91,11 +90,11 @@ public abstract class HyperlinkGroupPane extends UIListControlPane {
return Inter.getLocText("FR-Designer_Add_Hyperlink");
}
public void populate(NameJavaScriptGroup nameHyperlink_array) {
java.util.List<NameObject> list = new ArrayList<NameObject>();
if (nameHyperlink_array != null) {
for (int i = 0; i < nameHyperlink_array.size(); i++) {
list.add(new NameObject(nameHyperlink_array.getNameHyperlink(i).getName(), nameHyperlink_array.getNameHyperlink(i).getJavaScript()));
public void populate(NameJavaScriptGroup hyperlinkArray) {
java.util.List<NameObject> list = new ArrayList<>();
if (hyperlinkArray != null) {
for (int i = 0; i < hyperlinkArray.size(); i++) {
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() {
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++) {
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
public void saveSettings() {
if (isPopulating) {
if (isPopulating || !needAutoSave()) {
return;
}
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;
/**
* @author plough
* Created by plough on 2017/7/26.
*/
public interface HyperlinkGroupPaneActionProvider {
/**
* 刷新面板展示
*
* @param hyperlinkGroupPane 超链面板
* @param elementCasePane 模板
*/
void populate(HyperlinkGroupPane hyperlinkGroupPane, TargetComponent elementCasePane);
/**
* 保存到文件
*
* @param hyperlinkGroupPane 超联面板
*/
void saveSettings(HyperlinkGroupPane hyperlinkGroupPane);
}

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

@ -1,15 +1,15 @@
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.NameableCreator;
import com.fr.design.gui.frpane.HyperlinkGroupPane;
import com.fr.design.form.javascript.FormEmailPane;
import com.fr.design.gui.frpane.HyperlinkGroupPaneActionProvider;
import com.fr.general.ComparatorUtils;
import com.fr.general.Inter;
import com.fr.js.EmailJavaScript;
public class FormHyperlinkGroupPane extends HyperlinkGroupPane{
public class FormHyperlinkGroupPane extends HyperlinkGroupPane {
private static FormHyperlinkGroupPane singleton;
protected FormHyperlinkGroupPane(HyperlinkGroupPaneActionProvider hyperlinkGroupPaneActionProvider) {
@ -29,9 +29,10 @@ public class FormHyperlinkGroupPane extends HyperlinkGroupPane{
*
* @return 返回Nameable按钮数组.
*/
@Override
public NameableCreator[] createNameableCreators() {
NameableCreator[] creators = super.createNameableCreators();
for (int i=0; i<creators.length; i++) {
for (int i = 0; i < creators.length; i++) {
if (ComparatorUtils.equals(creators[i].menuName(), Inter.getLocText("FR-Designer_Email"))) {
creators[i] = new NameObjectCreator(Inter.getLocText("FR-Designer_Email"), EmailJavaScript.class, FormEmailPane.class);
break;

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

@ -1,38 +1,42 @@
package com.fr.design.mainframe;
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.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.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.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.present.ConditionAttributesGroupPane;
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.grid.selection.Selection;
import com.fr.page.ReportSettingsProvider;
import com.fr.report.worksheet.WorkSheet;
import com.fr.stable.ArrayUtils;
import javax.swing.*;
import java.awt.*;
import javax.swing.JPanel;
import java.awt.BorderLayout;
/**
* 类说明: 设计面板中最上方的"插入" "单元格"下拉列表Menu模块.
@ -81,11 +85,11 @@ public class ElementCasePaneDelegate extends ElementCasePane<WorkSheet> {
CellElementPropertyPane.getInstance().populate(ElementCasePaneDelegate.this);
QuickEditorRegion.getInstance().populate(getCurrentEditor());
JTemplate editingTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
// 模板初始化完成后,才能初始化超级链接面板
if (editingTemplate != null && !editingTemplate.isUpMode()) {
Selection editingSelection = getSelection();
// 模板初始化完成后,才能初始化超级链接面板
// 获取超级链接面板并刷新显示
HyperlinkGroupPane hyperlinkGroupPane = editingTemplate.getHyperLinkPane(HyperlinkGroupPaneActionImpl.getInstance());
hyperlinkGroupPane.populate(ElementCasePaneDelegate.this);
if (editingSelection instanceof FloatSelection) {
EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.REPORT_FLOAT);
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() {
return false;
}
@Override
public boolean needAutoSave() {
return false;
}
}

Loading…
Cancel
Save