Browse Source

Merge pull request #1482 in BA/design from ~NEIL/design:release/9.0 to feature/9.0

* commit '041918a62e23e9dfab0be955c03d726333b23422': (862 commits)
  1
  1
  1
  1
  REPORT-5661 mac设计器打开最近的模板,提示模板不存在
  REPORT-5661 区分mac和windows
  优先处理内存释放问题
  REPORT-5661 mac设计器打开最近的模板,提示模板不存在
  格式化JavaScript代码+登录接口
  REPORT-5668 单元格元素与悬浮元素图表配置问题
  REPORT-5700 设计器图标补充修改
  REPORT-5262 alphafine 远程设计搜索模板速度慢
  默认模板启动问题
  REPORT-5668 单元格元素和悬浮元素编辑器频繁初始化导致的内存激增问题
  a
  REPORT-4386 界面,超链-邮件,编辑框内容输入后显示不全
  REPORT-5692 [9.0三轮回归] 查询按钮改名字后,不会立即在设计器改变名字
  REPORT-5692 [9.0三轮回归] 查询按钮改名字后,不会立即在设计器改变名字
  REPORT-5134 设计器单元格里插入控件后,复制粘贴,显示null
  REPORT-5097 9.0,切换到本地其他目录,点击帮助-产品演示,不需要切换目录的提示 暂时先不改
  ...
master
neil 7 years ago
parent
commit
48a2efc227
  1. 4
      build.9.0.gradle
  2. 44
      designer/designer.iml
  3. 6
      designer/src/com/fr/design/actions/ButtonGroupAction.java
  4. 22
      designer/src/com/fr/design/actions/cell/AbstractCellElementAction.java
  5. 5
      designer/src/com/fr/design/actions/cell/CellAttributeAction.java
  6. 10
      designer/src/com/fr/design/actions/cell/CellAttributeTableAction.java
  7. 61
      designer/src/com/fr/design/actions/cell/CellWidgetAttrAction.java
  8. 35
      designer/src/com/fr/design/actions/cell/ConditionAttributesAction.java
  9. 1
      designer/src/com/fr/design/actions/cell/GlobalStyleMenuDef.java
  10. 23
      designer/src/com/fr/design/actions/cell/style/AlignmentAction.java
  11. 12
      designer/src/com/fr/design/actions/cell/style/ReportFontBoldAction.java
  12. 9
      designer/src/com/fr/design/actions/cell/style/ReportFontItalicAction.java
  13. 7
      designer/src/com/fr/design/actions/cell/style/ReportFontUnderlineAction.java
  14. 20
      designer/src/com/fr/design/actions/columnrow/DSColumnConditionAction.java
  15. 30
      designer/src/com/fr/design/actions/edit/HyperlinkAction.java
  16. 4
      designer/src/com/fr/design/actions/insert/cell/FormulaCellAction.java
  17. 46
      designer/src/com/fr/design/actions/insert/flot/ChartFloatAction.java
  18. 72
      designer/src/com/fr/design/actions/insert/flot/FormulaFloatAction.java
  19. 33
      designer/src/com/fr/design/actions/insert/flot/ImageFloatAction.java
  20. 6
      designer/src/com/fr/design/actions/insert/flot/TextBoxFloatAction.java
  21. 41
      designer/src/com/fr/design/cell/bar/DynamicScrollButton.java
  22. 7
      designer/src/com/fr/design/cell/clipboard/CellElementsClip.java
  23. 2
      designer/src/com/fr/design/cell/editor/AbstractCellEditor.java
  24. 10
      designer/src/com/fr/design/cell/editor/FormulaCellEditor.java
  25. 10
      designer/src/com/fr/design/cell/editor/FormulaFloatEditor.java
  26. 29
      designer/src/com/fr/design/cell/editor/RichTextToolBar.java
  27. 2
      designer/src/com/fr/design/condition/HyperlinkPane.java
  28. 10
      designer/src/com/fr/design/condition/WidgetHighlightPane.java
  29. 29
      designer/src/com/fr/design/dscolumn/DSColumnAdvancedPane.java
  30. 2
      designer/src/com/fr/design/dscolumn/DSColumnConditionsPane.java
  31. 73
      designer/src/com/fr/design/dscolumn/ResultSetGroupDockingPane.java
  32. 2
      designer/src/com/fr/design/dscolumn/SelectedDataColumnPane.java
  33. 6
      designer/src/com/fr/design/dscolumn/SpecifiedGroupAttrPane.java
  34. 8
      designer/src/com/fr/design/expand/SortExpandAttrPane.java
  35. 16
      designer/src/com/fr/design/headerfooter/HFAttributesEditDialog.java
  36. 5
      designer/src/com/fr/design/mainframe/ActiveKeyGenerator.java
  37. 1
      designer/src/com/fr/design/mainframe/AuthorityToolBarPane.java
  38. 8
      designer/src/com/fr/design/mainframe/CellElementPropertyPane.java
  39. 48
      designer/src/com/fr/design/mainframe/CellWidgetPropertyPane.java
  40. 97
      designer/src/com/fr/design/mainframe/ElementCasePane.java
  41. 44
      designer/src/com/fr/design/mainframe/ElementCasePaneDelegate.java
  42. 71
      designer/src/com/fr/design/mainframe/InformationCollector.java
  43. 20
      designer/src/com/fr/design/mainframe/JWorkBook.java
  44. 5
      designer/src/com/fr/design/mainframe/ReportComponent.java
  45. 51
      designer/src/com/fr/design/mainframe/ReportComponentComposite.java
  46. 26
      designer/src/com/fr/design/mainframe/ReportFloatPane.java
  47. 5
      designer/src/com/fr/design/mainframe/ReportHyperlinkGroupPane.java
  48. 27
      designer/src/com/fr/design/mainframe/ReportHyperlinkGroupPaneNoPop.java
  49. 44
      designer/src/com/fr/design/mainframe/SheetNameTabPane.java
  50. 11
      designer/src/com/fr/design/mainframe/WorkSheetDesigner.java
  51. 17
      designer/src/com/fr/design/mainframe/alphafine/AlphaFineConstants.java
  52. 4
      designer/src/com/fr/design/mainframe/alphafine/AlphaFineHelper.java
  53. 13
      designer/src/com/fr/design/mainframe/alphafine/cell/model/ActionModel.java
  54. 1
      designer/src/com/fr/design/mainframe/alphafine/cell/model/AlphaCellModel.java
  55. 13
      designer/src/com/fr/design/mainframe/alphafine/cell/render/ContentCellRender.java
  56. 9
      designer/src/com/fr/design/mainframe/alphafine/cell/render/TitleCellRender.java
  57. 345
      designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java
  58. 18
      designer/src/com/fr/design/mainframe/alphafine/component/AlphaFinePane.java
  59. BIN
      designer/src/com/fr/design/mainframe/alphafine/images/alphafine1@2x.png
  60. BIN
      designer/src/com/fr/design/mainframe/alphafine/images/alphafine2@2x.png
  61. BIN
      designer/src/com/fr/design/mainframe/alphafine/images/alphafine3@2x.png
  62. BIN
      designer/src/com/fr/design/mainframe/alphafine/images/alphafine4@2x.png
  63. BIN
      designer/src/com/fr/design/mainframe/alphafine/images/alphafine5@2x.png
  64. BIN
      designer/src/com/fr/design/mainframe/alphafine/images/alphafine_close@2x.png
  65. BIN
      designer/src/com/fr/design/mainframe/alphafine/images/bigloading.gif
  66. BIN
      designer/src/com/fr/design/mainframe/alphafine/images/bigsearch.png
  67. BIN
      designer/src/com/fr/design/mainframe/alphafine/images/bigsearch@2x.png
  68. BIN
      designer/src/com/fr/design/mainframe/alphafine/images/no_result.png
  69. BIN
      designer/src/com/fr/design/mainframe/alphafine/images/no_result@2x.png
  70. BIN
      designer/src/com/fr/design/mainframe/alphafine/images/noresult@2x.png
  71. BIN
      designer/src/com/fr/design/mainframe/alphafine/images/opening@2x.gif
  72. BIN
      designer/src/com/fr/design/mainframe/alphafine/images/selected1@2x.png
  73. BIN
      designer/src/com/fr/design/mainframe/alphafine/images/selected2@2x.png
  74. BIN
      designer/src/com/fr/design/mainframe/alphafine/images/selected3@2x.png
  75. BIN
      designer/src/com/fr/design/mainframe/alphafine/images/selected4@2x.png
  76. BIN
      designer/src/com/fr/design/mainframe/alphafine/images/selected5@2x.png
  77. BIN
      designer/src/com/fr/design/mainframe/alphafine/images/smallsearch.png
  78. BIN
      designer/src/com/fr/design/mainframe/alphafine/images/smallsearch@2x.png
  79. 37
      designer/src/com/fr/design/mainframe/alphafine/preview/ActionPreviewPane.java
  80. 29
      designer/src/com/fr/design/mainframe/alphafine/preview/DocumentPreviewPane.java
  81. 32
      designer/src/com/fr/design/mainframe/alphafine/preview/NoResultPane.java
  82. 4
      designer/src/com/fr/design/mainframe/alphafine/preview/PluginPreviewPane.java
  83. 9
      designer/src/com/fr/design/mainframe/alphafine/search/manager/ActionSearchManager.java
  84. 10
      designer/src/com/fr/design/mainframe/alphafine/search/manager/DocumentSearchManager.java
  85. 16
      designer/src/com/fr/design/mainframe/alphafine/search/manager/FileSearchManager.java
  86. 10
      designer/src/com/fr/design/mainframe/alphafine/search/manager/PluginSearchManager.java
  87. 29
      designer/src/com/fr/design/mainframe/alphafine/search/manager/RecentSearchManager.java
  88. 2
      designer/src/com/fr/design/mainframe/alphafine/search/manager/RecommendSearchManager.java
  89. 32
      designer/src/com/fr/design/mainframe/bbs/BBSConstants.java
  90. 24
      designer/src/com/fr/design/mainframe/bbs/BBSGuestPane.java
  91. 8
      designer/src/com/fr/design/mainframe/bbs/BBSLoginDialog.java
  92. 6
      designer/src/com/fr/design/mainframe/bbs/ExitLabel.java
  93. 101
      designer/src/com/fr/design/mainframe/bbs/UserInfoLabel.java
  94. 46
      designer/src/com/fr/design/mainframe/bbs/UserInfoPane.java
  95. 12
      designer/src/com/fr/design/mainframe/bbs/bbs.properties
  96. 123
      designer/src/com/fr/design/mainframe/cell/AbstractDSCellEditorPane.java
  97. 28
      designer/src/com/fr/design/mainframe/cell/CellEditorPane.java
  98. 19
      designer/src/com/fr/design/mainframe/cell/CellElementEditPane.java
  99. 36
      designer/src/com/fr/design/mainframe/cell/settingpane/CellExpandAttrPane.java
  100. 72
      designer/src/com/fr/design/mainframe/cell/settingpane/CellOtherSetPane.java
  101. Some files were not shown because too many files have changed in this diff Show More

4
build.9.0.gradle

@ -11,12 +11,12 @@ task appletJar<<{
mkdir(dir:"./tmp") mkdir(dir:"./tmp")
mkdir(dir:"build/classes/main") mkdir(dir:"build/classes/main")
copy(todir:"build/classes/"){ copy(todir:"build/classes/"){
fileset(dir:"${basicDir}/core/build/classes/main")
fileset(dir:"${basicDir}/chart/build/classes/main") fileset(dir:"${basicDir}/chart/build/classes/main")
fileset(dir:"${basicDir}/report/build/classes/main") fileset(dir:"${basicDir}/report/build/classes/main")
fileset(dir:"${basicDir}/platform/build/classes/main") fileset(dir:"${basicDir}/platform/build/classes/main")
} }
unjar(src:"${libDir}/3rd.jar",dest:"./tmp") unjar(src:"${libDir}/fr-core-9.0.jar",dest:"./tmp")
unjar(src:"${libDir}/fr-third-9.0.jar",dest:"./tmp")
unjar(src:"${libDir}/servlet-api.jar",dest:"./tmp") unjar(src:"${libDir}/servlet-api.jar",dest:"./tmp")
jar(jarfile:"build/libs/fr-applet-9.0.jar"){ jar(jarfile:"build/libs/fr-applet-9.0.jar"){
fileset(dir:"build/classes"){ fileset(dir:"build/classes"){

44
designer/designer.iml

@ -1,44 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module" module-name="designer_base" />
<orderEntry type="module" module-name="designer_form" />
<orderEntry type="module" module-name="designer_chart" />
<orderEntry type="module" module-name="designer_chart" />
<orderEntry type="module" module-name="designer_base" />
<orderEntry type="module" module-name="designer_form" />
<orderEntry type="module" module-name="base" />
<orderEntry type="module" module-name="base-basic" />
<orderEntry type="module" module-name="base-calculate" />
<orderEntry type="module" module-name="base-data" />
<orderEntry type="module" module-name="base-file" />
<orderEntry type="module" module-name="base-performance" />
<orderEntry type="module" module-name="base-plugin-engine" />
<orderEntry type="module" module-name="base-stable" />
<orderEntry type="module" module-name="chart-base" />
<orderEntry type="module" module-name="chart-chartattr" />
<orderEntry type="module" module-name="chart-chartdata" />
<orderEntry type="module" module-name="chart-chartglyph" />
<orderEntry type="module" module-name="chart-web" />
<orderEntry type="module" module-name="engine" />
<orderEntry type="module" module-name="engine-cross" />
<orderEntry type="module" module-name="engine-enhancement" />
<orderEntry type="module" module-name="engine-page" />
<orderEntry type="module" module-name="engine-remote" />
<orderEntry type="module" module-name="engine-view" />
<orderEntry type="module" module-name="engine-write" />
<orderEntry type="module" module-name="fmobile" />
<orderEntry type="module" module-name="form" />
<orderEntry type="module" module-name="fsbakrestore" />
<orderEntry type="module" module-name="fschedule" />
<orderEntry type="module" module-name="fservice" />
<orderEntry type="module" module-name="fsmonitor" />
<orderEntry type="library" name="lib" level="project" />
</component>
</module>

6
designer/src/com/fr/design/actions/ButtonGroupAction.java

@ -6,12 +6,12 @@ import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.mainframe.ElementCasePane; import com.fr.design.mainframe.ElementCasePane;
public abstract class ButtonGroupAction extends ElementCaseAction{ public abstract class ButtonGroupAction extends ElementCaseAction{
protected Icon[] iconArray; protected Icon[][] iconArray;
protected Integer[] valueArray; protected Integer[] valueArray;
private UIButtonGroup<Integer> group; private UIButtonGroup<Integer> group;
protected ButtonGroupAction(ElementCasePane t, Icon[] iconArray, Integer[] valueArray) { protected ButtonGroupAction(ElementCasePane t, Icon[][] iconArray, Integer[] valueArray) {
super(t); super(t);
this.iconArray = iconArray; this.iconArray = iconArray;
this.valueArray = valueArray; this.valueArray = valueArray;
@ -36,7 +36,7 @@ public abstract class ButtonGroupAction extends ElementCaseAction{
break; break;
} }
} }
if(value == -1 && createToolBarComponent().hasClick()) { if(createToolBarComponent().hasClick()) {
index = getSelectedIndex(); index = getSelectedIndex();
createToolBarComponent().setClickState(false); createToolBarComponent().setClickState(false);
} }

22
designer/src/com/fr/design/actions/cell/AbstractCellElementAction.java

@ -1,10 +1,10 @@
package com.fr.design.actions.cell; package com.fr.design.actions.cell;
import com.fr.design.actions.CellSelectionAction; import com.fr.design.actions.CellSelectionAction;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.ElementCasePane; import com.fr.design.mainframe.ElementCasePane;
import com.fr.grid.GridUtils; import com.fr.grid.GridUtils;
import com.fr.grid.selection.CellSelection; import com.fr.grid.selection.CellSelection;
@ -14,8 +14,17 @@ import com.fr.report.core.SheetUtils;
import com.fr.report.elementcase.TemplateElementCase; import com.fr.report.elementcase.TemplateElementCase;
import com.fr.report.stable.ReportConstants; import com.fr.report.stable.ReportConstants;
// TODO ALEX_SEP 这个类与AbstractCellAction有什么关系? /**
* TODO ALEX_SEP 这个类与AbstractCellAction有什么关系?
*
* @author null
*/
public abstract class AbstractCellElementAction extends CellSelectionAction { public abstract class AbstractCellElementAction extends CellSelectionAction {
protected AbstractCellElementAction() {
super();
}
protected AbstractCellElementAction(ElementCasePane t) { protected AbstractCellElementAction(ElementCasePane t) {
super(t); super(t);
} }
@ -29,9 +38,7 @@ public abstract class AbstractCellElementAction extends CellSelectionAction {
editCellElement = new DefaultTemplateCellElement(cs.getColumn(), cs.getRow()); editCellElement = new DefaultTemplateCellElement(cs.getColumn(), cs.getRow());
tplEC.addCellElement(editCellElement); tplEC.addCellElement(editCellElement);
} }
if (tplEC != null) {
SheetUtils.calculateDefaultParent(tplEC); SheetUtils.calculateDefaultParent(tplEC);
}
final CellSelection finalCS = cs; final CellSelection finalCS = cs;
final BasicPane bp = populateBasicPane(editCellElement); final BasicPane bp = populateBasicPane(editCellElement);
BasicDialog dialog = bp.showWindow(DesignerContext.getDesignerFrame()); BasicDialog dialog = bp.showWindow(DesignerContext.getDesignerFrame());
@ -76,16 +83,15 @@ public abstract class AbstractCellElementAction extends CellSelectionAction {
/** /**
* 初始化对话框 * 初始化对话框
* *
* @param cellElement * @param cellElement 单元格
* @return * @return 对话框
*/ */
protected abstract BasicPane populateBasicPane(TemplateCellElement cellElement); protected abstract BasicPane populateBasicPane(TemplateCellElement cellElement);
/** /**
* 更新对话框之后改变值 * 更新对话框之后改变值
* *
* @param cellElement * @param cellElement 单元格
* @return
*/ */
protected abstract void updateBasicPane(BasicPane basicPane, TemplateCellElement cellElement); protected abstract void updateBasicPane(BasicPane basicPane, TemplateCellElement cellElement);

5
designer/src/com/fr/design/actions/cell/CellAttributeAction.java

@ -1,5 +1,6 @@
package com.fr.design.actions.cell; package com.fr.design.actions.cell;
import com.fr.base.BaseUtils;
import com.fr.design.menu.KeySetUtils; import com.fr.design.menu.KeySetUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
@ -9,9 +10,9 @@ import com.fr.general.Inter;
public class CellAttributeAction extends CellAttributeTableAction { public class CellAttributeAction extends CellAttributeTableAction {
public CellAttributeAction() { public CellAttributeAction() {
this.setMenuKeySet(KeySetUtils.CELL_OTHER_ATTR); this.setMenuKeySet(KeySetUtils.CELL_OTHER_ATTR);
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_format/cellAttr.png")); this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_format/cellAttr.png"));
} }
@Override @Override

10
designer/src/com/fr/design/actions/cell/CellAttributeTableAction.java

@ -1,9 +1,10 @@
package com.fr.design.actions.cell; package com.fr.design.actions.cell;
import java.awt.event.ActionEvent;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.mainframe.CellElementPropertyPane; import com.fr.design.mainframe.CellElementPropertyPane;
import com.fr.design.mainframe.EastRegionContainerPane;
import java.awt.event.ActionEvent;
/** /**
* 所有的CellAttributeTableAction都是指向单元格属性表的,点了就自动跳转到单元格属性表 * 所有的CellAttributeTableAction都是指向单元格属性表的,点了就自动跳转到单元格属性表
@ -20,4 +21,9 @@ public abstract class CellAttributeTableAction extends UpdateAction {
CellElementPropertyPane.getInstance().GoToPane(getID()); CellElementPropertyPane.getInstance().GoToPane(getID());
} }
@Override
public void update() {
super.update();
this.setEnabled(EastRegionContainerPane.getInstance().isCellAttrPaneEnabled());
}
} }

61
designer/src/com/fr/design/actions/cell/CellWidgetAttrAction.java

@ -1,24 +1,18 @@
package com.fr.design.actions.cell; package com.fr.design.actions.cell;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.design.mainframe.ElementCasePane; import com.fr.design.actions.UpdateAction;
import com.fr.design.mainframe.EastRegionContainerPane;
import com.fr.design.menu.KeySetUtils; import com.fr.design.menu.KeySetUtils;
import com.fr.design.present.CellWriteAttrPane;
import com.fr.design.dialog.BasicPane; import java.awt.event.ActionEvent;
import com.fr.form.ui.Widget;
import com.fr.general.FRLogger;
import com.fr.grid.selection.CellSelection;
import com.fr.grid.selection.Selection;
import com.fr.privilege.finegrain.WidgetPrivilegeControl;
import com.fr.report.cell.TemplateCellElement;
/** /**
* Cell Widget Attribute. * Cell Widget Attribute.
*/ */
public class CellWidgetAttrAction extends AbstractCellElementAction { public class CellWidgetAttrAction extends UpdateAction {
public CellWidgetAttrAction(ElementCasePane t) { public CellWidgetAttrAction() {
super(t);
this.setMenuKeySet(KeySetUtils.CELL_WIDGET_ATTR); this.setMenuKeySet(KeySetUtils.CELL_WIDGET_ATTR);
this.setName(getMenuKeySet().getMenuKeySetName()); this.setName(getMenuKeySet().getMenuKeySetName());
this.setMnemonic(getMenuKeySet().getMnemonic()); this.setMnemonic(getMenuKeySet().getMnemonic());
@ -26,47 +20,14 @@ public class CellWidgetAttrAction extends AbstractCellElementAction {
} }
@Override @Override
protected BasicPane populateBasicPane(TemplateCellElement cellElement) { public void actionPerformed(ActionEvent e) {
CellWriteAttrPane pane = new CellWriteAttrPane(this.getEditingComponent()); EastRegionContainerPane.getInstance().switchTabTo(EastRegionContainerPane.KEY_WIDGET_SETTINGS);
//got simple cell element from column and row. EastRegionContainerPane.getInstance().setWindow2PreferWidth();
pane.populate(cellElement);
return pane;
}
@Override
protected void updateBasicPane(BasicPane bp, TemplateCellElement cellElement) {
CellWriteAttrPane pane = (CellWriteAttrPane) bp;
if (cellElement.getWidget() == null) {
pane.update(cellElement);
return;
}
try {
Widget oldWidget = (Widget) cellElement.getWidget().clone();
pane.update(cellElement);
//这边需要重新设置权限细粒度的hashset是因为Update是直接生成一个新的来update的,所以以前里面的hashset都没有了
Widget newWidget = cellElement.getWidget();
if (newWidget.getClass() == oldWidget.getClass()) {
newWidget.setWidgetPrivilegeControl((WidgetPrivilegeControl) oldWidget.getWidgetPrivilegeControl().clone());
}
} catch (Exception e) {
FRLogger.getLogger().error(e.getMessage());
}
}
@Override
protected boolean isNeedShinkToFit() {
return true;
} }
@Override @Override
public void update() { public void update() {
ElementCasePane ePane = this.getEditingComponent(); super.update();
Selection sel = ePane.getSelection(); this.setEnabled(EastRegionContainerPane.getInstance().isWidgetSettingsPaneEnabled());
if (sel instanceof CellSelection) {
this.setEnabled(true);
} else {
this.setEnabled(false);
}
} }
} }

35
designer/src/com/fr/design/actions/cell/ConditionAttributesAction.java

@ -0,0 +1,35 @@
/*
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved.
*/
package com.fr.design.actions.cell;
import com.fr.base.BaseUtils;
import com.fr.design.actions.UpdateAction;
import com.fr.design.mainframe.EastRegionContainerPane;
import com.fr.design.menu.KeySetUtils;
import java.awt.event.ActionEvent;
/**
* Condition Attributes.
*/
public class ConditionAttributesAction extends UpdateAction {
public ConditionAttributesAction() {
this.setMenuKeySet(KeySetUtils.CONDITION_ATTR);
this.setName(getMenuKeySet().getMenuKeySetName());
this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_format/highlight.png"));
}
@Override
public void actionPerformed(ActionEvent e) {
EastRegionContainerPane.getInstance().switchTabTo(EastRegionContainerPane.KEY_CONDITION_ATTR);
EastRegionContainerPane.getInstance().setWindow2PreferWidth();
}
@Override
public void update() {
super.update();
this.setEnabled(EastRegionContainerPane.getInstance().isConditionAttrPaneEnabled());
}
}

1
designer/src/com/fr/design/actions/cell/GlobalStyleMenuDef.java

@ -186,6 +186,7 @@ public class GlobalStyleMenuDef extends MenuDef {
} }
stylePane.updateGlobalStyle(getEditingComponent()); stylePane.updateGlobalStyle(getEditingComponent());
CellElementPropertyPane.getInstance().GoToPane(Inter.getLocText("FR-Designer-Widget_Style"));
return true; return true;
} }

23
designer/src/com/fr/design/actions/cell/style/AlignmentAction.java

@ -1,27 +1,36 @@
package com.fr.design.actions.cell.style; package com.fr.design.actions.cell.style;
import javax.swing.Icon;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.Style; import com.fr.base.Style;
import com.fr.base.chart.BaseChartCollection; import com.fr.base.chart.BaseChartCollection;
import com.fr.design.constants.UIConstants;
import com.fr.design.actions.ButtonGroupAction; import com.fr.design.actions.ButtonGroupAction;
import com.fr.design.actions.utils.ReportActionUtils; import com.fr.design.actions.utils.ReportActionUtils;
import com.fr.design.constants.UIConstants;
import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.general.Inter; import com.fr.design.gui.ibutton.UIToggleButton;
import com.fr.design.mainframe.ElementCasePane; import com.fr.design.mainframe.ElementCasePane;
import com.fr.general.Inter;
import com.fr.grid.selection.FloatSelection; import com.fr.grid.selection.FloatSelection;
import com.fr.grid.selection.Selection; import com.fr.grid.selection.Selection;
import com.fr.report.cell.FloatElement; import com.fr.report.cell.FloatElement;
import com.fr.report.elementcase.TemplateElementCase; import com.fr.report.elementcase.TemplateElementCase;
import com.fr.stable.Constants;
import javax.swing.*;
public class AlignmentAction extends ButtonGroupAction implements StyleActionInterface { public class AlignmentAction extends ButtonGroupAction implements StyleActionInterface {
public AlignmentAction(ElementCasePane t, Icon[] iconArray, private static final Icon[][] ICONS = new Icon[][]{
Integer[] valueArray) { {BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_left_normal.png"), BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_left_normal_white.png")},
super(t, iconArray, valueArray); {BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_center_normal.png"), BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_center_normal_white.png")},
{BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_right_normal.png"), BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_right_normal_white.png")}};
private static final Integer[] valueArray = new Integer[]{Constants.LEFT, Constants.CENTER, Constants.RIGHT};
public AlignmentAction(ElementCasePane t) {
super(t, ICONS, valueArray);
} }

12
designer/src/com/fr/design/actions/cell/style/ReportFontBoldAction.java

@ -8,10 +8,12 @@ import com.fr.base.Style;
import com.fr.base.core.StyleUtils; import com.fr.base.core.StyleUtils;
import com.fr.design.actions.ToggleButtonUpdateAction; import com.fr.design.actions.ToggleButtonUpdateAction;
import com.fr.design.gui.ibutton.UIToggleButton; import com.fr.design.gui.ibutton.UIToggleButton;
import com.fr.general.FRFont;
import com.fr.general.Inter;
import com.fr.design.mainframe.ElementCasePane; import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.FRFont;
import com.fr.general.Inter;
import javax.swing.*;
/** /**
* Bold. * Bold.
@ -19,12 +21,13 @@ import com.fr.design.utils.gui.GUICoreUtils;
public class ReportFontBoldAction extends AbstractStyleAction implements ToggleButtonUpdateAction { public class ReportFontBoldAction extends AbstractStyleAction implements ToggleButtonUpdateAction {
private UIToggleButton button; private UIToggleButton button;
protected Style style; protected Style style;
private final static Icon[] ICONS = {BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/bold.png"), BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/bold_white.png")};
public ReportFontBoldAction(ElementCasePane t) { public ReportFontBoldAction(ElementCasePane t) {
super(t); super(t);
this.setName(Inter.getLocText("FRFont-bold")); this.setName(Inter.getLocText("FRFont-bold"));
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/bold.png")); this.setSmallIcon(ICONS, true);
} }
/** /**
@ -48,6 +51,7 @@ public class ReportFontBoldAction extends AbstractStyleAction implements ToggleB
return this.style; return this.style;
} }
protected void setSelectedFont(Style style) { protected void setSelectedFont(Style style) {
this.style = StyleUtils.boldReportFont(style); this.style = StyleUtils.boldReportFont(style);
} }
@ -83,7 +87,7 @@ public class ReportFontBoldAction extends AbstractStyleAction implements ToggleB
@Override @Override
public UIToggleButton createToolBarComponent() { public UIToggleButton createToolBarComponent() {
if (button == null) { if (button == null) {
button = GUICoreUtils.createToolBarComponent(this); button = GUICoreUtils.createToolBarComponentWhiteIcon(this);
button.setEventBannded(true); button.setEventBannded(true);
} }
return button; return button;

9
designer/src/com/fr/design/actions/cell/style/ReportFontItalicAction.java

@ -10,16 +10,20 @@ import com.fr.general.FRFont;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.design.mainframe.ElementCasePane; import com.fr.design.mainframe.ElementCasePane;
import javax.swing.*;
/** /**
* Bold. * Bold.
*/ */
public class ReportFontItalicAction extends ReportFontBoldAction { public class ReportFontItalicAction extends ReportFontBoldAction {
private final static Icon[] ICONS = {BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/italic.png"), BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/italic_white.png")};
public ReportFontItalicAction(ElementCasePane t) { public ReportFontItalicAction(ElementCasePane t) {
super(t); super(t);
this.setName(Inter.getLocText("FRFont-italic")); this.setName(Inter.getLocText("FR-Designer-FRFont_Italic"));
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/italic.png")); this.setSmallIcon(ICONS, true);
} }
@ -31,7 +35,6 @@ public class ReportFontItalicAction extends ReportFontBoldAction {
this.style = StyleUtils.unItalicReportFont(style); this.style = StyleUtils.unItalicReportFont(style);
} }
protected boolean isStyle(FRFont frFont) { protected boolean isStyle(FRFont frFont) {
return frFont.isItalic(); return frFont.isItalic();
} }

7
designer/src/com/fr/design/actions/cell/style/ReportFontUnderlineAction.java

@ -11,15 +11,20 @@ import com.fr.general.Inter;
import com.fr.design.mainframe.ElementCasePane; import com.fr.design.mainframe.ElementCasePane;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import javax.swing.*;
/** /**
* Bold. * Bold.
*/ */
public class ReportFontUnderlineAction extends ReportFontBoldAction { public class ReportFontUnderlineAction extends ReportFontBoldAction {
private final static Icon[] ICONS = {BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/underline.png"), BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/underline_white.png")};
public ReportFontUnderlineAction(ElementCasePane t) { public ReportFontUnderlineAction(ElementCasePane t) {
super(t); super(t);
this.setName(Inter.getLocText("FRFont-Underline")); this.setName(Inter.getLocText("FRFont-Underline"));
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/underline.png")); this.setSmallIcon(ICONS, true);
} }
protected void setSelectedFont (Style style) { protected void setSelectedFont (Style style) {

20
designer/src/com/fr/design/actions/columnrow/DSColumnConditionAction.java

@ -9,16 +9,34 @@ import com.fr.design.mainframe.ElementCasePane;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.report.cell.TemplateCellElement; import com.fr.report.cell.TemplateCellElement;
/**
* 数据列过滤条件Action
*
* @author null
* @version 2017年11月17日15点11分
* @since 8.0
*/
public class DSColumnConditionAction extends AbstractCellElementAction { public class DSColumnConditionAction extends AbstractCellElementAction {
public DSColumnConditionAction() {
super();
this.setName(Inter.getLocText("Filter"));
this.setMnemonic('E');
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/expand/cellAttr.gif"));
}
public DSColumnConditionAction(ElementCasePane t) { public DSColumnConditionAction(ElementCasePane t) {
super(t); super(t);
this.setName(Inter.getLocText("Filter")); this.setName(Inter.getLocText("Filter"));
this.setMnemonic('E'); this.setMnemonic('E');
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/expand/cellAttr.gif")); this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/expand/cellAttr.gif"));
} }
@Override
public void setEditingComponent(ElementCasePane casePane) {
super.setEditingComponent(casePane);
}
@Override @Override
protected BasicPane populateBasicPane(TemplateCellElement cellElement) { protected BasicPane populateBasicPane(TemplateCellElement cellElement) {
DSColumnConditionsPane dSColumnConditionsPane = new DSColumnConditionsPane(); DSColumnConditionsPane dSColumnConditionsPane = new DSColumnConditionsPane();

30
designer/src/com/fr/design/actions/edit/HyperlinkAction.java

@ -0,0 +1,30 @@
/*
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved.
*/
package com.fr.design.actions.edit;
import com.fr.base.BaseUtils;
import com.fr.design.actions.UpdateAction;
import com.fr.design.mainframe.EastRegionContainerPane;
import com.fr.design.menu.KeySetUtils;
import java.awt.event.ActionEvent;
/**
* HyperlinkAction.
*/
public class HyperlinkAction extends UpdateAction {
public HyperlinkAction() {
this.setMenuKeySet(KeySetUtils.HYPER_LINK);
this.setName(getMenuKeySet().getMenuKeySetName());
this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_insert/hyperLink.png"));
}
@Override
public void actionPerformed(ActionEvent e) {
EastRegionContainerPane.getInstance().switchTabTo(EastRegionContainerPane.KEY_HYPERLINK);
EastRegionContainerPane.getInstance().setWindow2PreferWidth();
}
}

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

@ -3,8 +3,8 @@
*/ */
package com.fr.design.actions.insert.cell; package com.fr.design.actions.insert.cell;
import com.fr.base.BaseFormula;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.Formula;
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;
import com.fr.design.menu.MenuKeySet; import com.fr.design.menu.MenuKeySet;
@ -48,6 +48,6 @@ public class FormulaCellAction extends AbstractCellAction implements WorkBookSup
@Override @Override
public Class getCellValueClass() { public Class getCellValueClass() {
return Formula.class; return BaseFormula.class;
} }
} }

46
designer/src/com/fr/design/actions/insert/flot/ChartFloatAction.java

@ -4,6 +4,7 @@
package com.fr.design.actions.insert.flot; package com.fr.design.actions.insert.flot;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.DynamicUnitList;
import com.fr.base.Style; import com.fr.base.Style;
import com.fr.base.chart.BaseChartCollection; import com.fr.base.chart.BaseChartCollection;
import com.fr.design.actions.ElementCaseAction; import com.fr.design.actions.ElementCaseAction;
@ -16,10 +17,14 @@ import com.fr.design.menu.MenuKeySet;
import com.fr.design.module.DesignModuleFactory; import com.fr.design.module.DesignModuleFactory;
import com.fr.general.FRLogger; import com.fr.general.FRLogger;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.grid.Grid;
import com.fr.grid.selection.FloatSelection; import com.fr.grid.selection.FloatSelection;
import com.fr.report.ReportHelper;
import com.fr.report.cell.FloatElement; import com.fr.report.cell.FloatElement;
import com.fr.report.elementcase.TemplateElementCase;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import com.fr.stable.bridge.StableFactory; import com.fr.stable.bridge.StableFactory;
import com.fr.stable.unit.FU;
import com.fr.stable.unit.OLDPIX; import com.fr.stable.unit.OLDPIX;
import javax.swing.*; import javax.swing.*;
@ -30,13 +35,15 @@ import java.awt.*;
*/ */
public class ChartFloatAction extends ElementCaseAction { public class ChartFloatAction extends ElementCaseAction {
private boolean isRecordNeeded;
/** /**
* 构造函数 图表插入悬浮元素 * 构造函数 图表插入悬浮元素
*/ */
public ChartFloatAction(ElementCasePane t) { public ChartFloatAction(ElementCasePane t) {
super(t); super(t);
this.setMenuKeySet(FLOAT_INSERT_CHART); this.setMenuKeySet(FLOAT_INSERT_CHART);
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/chart.png")); this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_insert/chart.png"));
} }
@ -64,9 +71,10 @@ public class ChartFloatAction extends ElementCaseAction {
* @return 是则返回true * @return 是则返回true
*/ */
public boolean executeActionReturnUndoRecordNeeded() { public boolean executeActionReturnUndoRecordNeeded() {
isRecordNeeded = false;
final ElementCasePane reportPane = (ElementCasePane) HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getCurrentElementCasePane(); final ElementCasePane reportPane = (ElementCasePane) HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getCurrentElementCasePane();
if (reportPane == null) { if (reportPane == null) {
return false; return isRecordNeeded;
} }
reportPane.stopEditing(); reportPane.stopEditing();
@ -78,25 +86,41 @@ public class ChartFloatAction extends ElementCaseAction {
chartDialog.addDialogActionListener(new DialogActionAdapter() { chartDialog.addDialogActionListener(new DialogActionAdapter() {
@Override @Override
public void doOk() { public void doOk() {
isRecordNeeded = true;
FloatElement newFloatElement; FloatElement newFloatElement;
try { try {
newFloatElement = new FloatElement(chartDialog.getChartCollection().clone()); newFloatElement = new FloatElement(chartDialog.getChartCollection().clone());
newFloatElement.setLeftDistance(new OLDPIX(20));
newFloatElement.setTopDistance(new OLDPIX(20));
newFloatElement.setWidth(new OLDPIX(BaseChartCollection.CHART_DEFAULT_WIDTH)); newFloatElement.setWidth(new OLDPIX(BaseChartCollection.CHART_DEFAULT_WIDTH));
newFloatElement.setHeight(new OLDPIX(BaseChartCollection.CHART_DEFAULT_HEIGHT)); newFloatElement.setHeight(new OLDPIX(BaseChartCollection.CHART_DEFAULT_HEIGHT));
Grid grid = reportPane.getGrid();
TemplateElementCase report = reportPane.getEditingElementCase();
DynamicUnitList columnWidthList = ReportHelper.getColumnWidthList(report);
DynamicUnitList rowHeightList = ReportHelper.getRowHeightList(report);
int horizentalScrollValue = grid.getHorizontalValue();
int verticalScrollValue = grid.getVerticalValue();
int resolution = grid.getResolution();
int floatWdith = newFloatElement.getWidth().toPixI(resolution);
int floatHeight = newFloatElement.getWidth().toPixI(resolution);
int leftDifference = (grid.getWidth() - floatWdith) > 0 ? (grid.getWidth() - floatWdith) : 0;
int topDifference = (grid.getHeight() - floatHeight) > 0 ? (grid.getHeight() - floatHeight) : 0;
FU evtX_fu = FU.valueOfPix((leftDifference) / 2, resolution);
FU evtY_fu = FU.valueOfPix((topDifference) / 2, resolution);
FU leftDistance = FU.getInstance(evtX_fu.toFU() + columnWidthList.getRangeValue(0, horizentalScrollValue).toFU());
FU topDistance = FU.getInstance(evtY_fu.toFU() + rowHeightList.getRangeValue(0, verticalScrollValue).toFU());
newFloatElement.setLeftDistance(leftDistance);
newFloatElement.setTopDistance(topDistance);
Style style = newFloatElement.getStyle(); Style style = newFloatElement.getStyle();
if (style != null) { if (style != null) {
newFloatElement.setStyle(style.deriveBorder(Constants.LINE_NONE, Color.black, newFloatElement.setStyle(style.deriveBorder(Constants.LINE_NONE, Color.black, Constants.LINE_NONE, Color.black, Constants.LINE_NONE, Color.black, Constants.LINE_NONE, Color.black));
Constants.LINE_NONE, Color.black,
Constants.LINE_NONE, Color.black,
Constants.LINE_NONE, Color.black));
} }
reportPane.getEditingElementCase().addFloatElement(newFloatElement); reportPane.getEditingElementCase().addFloatElement(newFloatElement);
reportPane.setSelection(new FloatSelection(newFloatElement.getName())); reportPane.setSelection(new FloatSelection(newFloatElement.getName()));
reportPane.fireTargetModified();
reportPane.fireSelectionChangeListener(); reportPane.fireSelectionChangeListener();
} catch (CloneNotSupportedException e) { } catch (CloneNotSupportedException e) {
FRLogger.getLogger().error("Error in Float"); FRLogger.getLogger().error("Error in Float");
@ -105,6 +129,6 @@ public class ChartFloatAction extends ElementCaseAction {
}); });
chartDialog.setVisible(true); chartDialog.setVisible(true);
return true; return isRecordNeeded;
} }
} }

72
designer/src/com/fr/design/actions/insert/flot/FormulaFloatAction.java

@ -3,10 +3,16 @@
*/ */
package com.fr.design.actions.insert.flot; package com.fr.design.actions.insert.flot;
import com.fr.base.BaseFormula;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.DynamicUnitList; 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.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.mainframe.ElementCasePane;
import com.fr.design.menu.MenuKeySet; import com.fr.design.menu.MenuKeySet;
import com.fr.general.Inter; import com.fr.general.Inter;
@ -18,16 +24,18 @@ import com.fr.report.elementcase.TemplateElementCase;
import com.fr.stable.unit.FU; import com.fr.stable.unit.FU;
import javax.swing.*; import javax.swing.*;
import java.awt.event.ActionEvent;
/** /**
* Insert formula. * Insert formula.
*/ */
public class FormulaFloatAction extends AbstractShapeAction { public class FormulaFloatAction extends ElementCaseAction {
private boolean returnValue = false;
public FormulaFloatAction(ElementCasePane t) { public FormulaFloatAction(ElementCasePane t) {
super(t); super(t);
this.setMenuKeySet(FLOAT_INSERT_FORMULA); this.setMenuKeySet(FLOAT_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"));
} }
@ -49,23 +57,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() { private void doWithDrawingFloatElement() {
ElementCasePane jws = (ElementCasePane) HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getCurrentElementCasePane(); ElementCasePane jws = (ElementCasePane) HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getCurrentElementCasePane();
Grid grid = jws.getGrid(); Grid grid = jws.getGrid();
@ -95,4 +86,43 @@ public class FormulaFloatAction extends AbstractShapeAction {
reportPane.setSelection(new FloatSelection(grid.getDrawingFloatElement().getName())); 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(BaseFormula.createFormulaBuilder().build());
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;
}
} }

33
designer/src/com/fr/design/actions/insert/flot/ImageFloatAction.java

@ -4,6 +4,7 @@
package com.fr.design.actions.insert.flot; package com.fr.design.actions.insert.flot;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.DynamicUnitList;
import com.fr.base.ScreenResolution; import com.fr.base.ScreenResolution;
import com.fr.design.actions.ElementCaseAction; import com.fr.design.actions.ElementCaseAction;
import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicDialog;
@ -14,9 +15,12 @@ import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.menu.MenuKeySet; import com.fr.design.menu.MenuKeySet;
import com.fr.design.report.SelectImagePane; import com.fr.design.report.SelectImagePane;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.grid.Grid;
import com.fr.grid.selection.FloatSelection; import com.fr.grid.selection.FloatSelection;
import com.fr.report.ReportHelper;
import com.fr.report.cell.FloatElement; import com.fr.report.cell.FloatElement;
import com.fr.report.cell.cellattr.CellImage; import com.fr.report.cell.cellattr.CellImage;
import com.fr.report.elementcase.TemplateElementCase;
import com.fr.stable.CoreGraphHelper; import com.fr.stable.CoreGraphHelper;
import com.fr.stable.unit.FU; import com.fr.stable.unit.FU;
@ -34,7 +38,7 @@ public class ImageFloatAction extends ElementCaseAction {
public ImageFloatAction(ElementCasePane t) { public ImageFloatAction(ElementCasePane t) {
super(t); super(t);
this.setMenuKeySet(FLOAT_INSERT_IMAGE); this.setMenuKeySet(FLOAT_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"));
} }
@ -87,12 +91,33 @@ public class ImageFloatAction extends ElementCaseAction {
CoreGraphHelper.waitForImage(image); CoreGraphHelper.waitForImage(image);
floatElement.setValue(image); floatElement.setValue(image);
Grid grid = reportPane.getGrid();
int resolution = ScreenResolution.getScreenResolution(); int resolution = grid.getResolution();
floatElement.setWidth(FU.valueOfPix(image.getWidth(null), resolution)); floatElement.setWidth(FU.valueOfPix(image.getWidth(null), resolution));
floatElement.setHeight(FU.valueOfPix(image.getHeight(null), resolution)); floatElement.setHeight(FU.valueOfPix(image.getHeight(null), resolution));
TemplateElementCase report = reportPane.getEditingElementCase();
DynamicUnitList columnWidthList = ReportHelper.getColumnWidthList(report);
DynamicUnitList rowHeightList = ReportHelper.getRowHeightList(report);
int horizentalScrollValue = grid.getHorizontalValue();
int verticalScrollValue = grid.getVerticalValue();
int floatWdith = floatElement.getWidth().toPixI(resolution);
int floatHeight = floatElement.getHeight().toPixI(resolution);
int leftDifference = (grid.getWidth() - floatWdith) > 0 ? (grid.getWidth() - floatWdith) : 0;
int topDifference = (grid.getHeight() - floatHeight) > 0 ? (grid.getHeight() - floatHeight) : 0;
FU evtX_fu = FU.valueOfPix((leftDifference) / 2, resolution);
FU evtY_fu = FU.valueOfPix((topDifference) / 2, resolution);
FU leftDistance = FU.getInstance(evtX_fu.toFU() + columnWidthList.getRangeValue(0, horizentalScrollValue).toFU());
FU topDistance = FU.getInstance(evtY_fu.toFU() + rowHeightList.getRangeValue(0, verticalScrollValue).toFU());
floatElement.setLeftDistance(leftDistance);
floatElement.setTopDistance(topDistance);
floatElement.setStyle(cellImage.getStyle()); floatElement.setStyle(cellImage.getStyle());
reportPane.addFloatElementToCenterOfElementPane(floatElement); // reportPane.addFloatElementToCenterOfElementPane(floatElement);
reportPane.getEditingElementCase().addFloatElement(floatElement);
reportPane.setSelection(new FloatSelection(floatElement.getName())); reportPane.setSelection(new FloatSelection(floatElement.getName()));
returnValue = true; returnValue = true;

6
designer/src/com/fr/design/actions/insert/flot/TextBoxFloatAction.java

@ -26,7 +26,7 @@ public class TextBoxFloatAction extends AbstractShapeAction {
public TextBoxFloatAction(ElementCasePane t) { public TextBoxFloatAction(ElementCasePane t) {
super(t); super(t);
this.setMenuKeySet(FLOAT_INSERT_TEXT); this.setMenuKeySet(FLOAT_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"));
} }
@ -54,6 +54,7 @@ public class TextBoxFloatAction extends AbstractShapeAction {
* *
* @param e 动作 * @param e 动作
*/ */
@Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
ElementCasePane jws = getEditingComponent(); ElementCasePane jws = getEditingComponent();
if (jws == null) { if (jws == null) {
@ -67,7 +68,7 @@ public class TextBoxFloatAction extends AbstractShapeAction {
private void doWithDrawingFloatElement() { private void doWithDrawingFloatElement() {
ElementCasePane jws = (ElementCasePane) HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getCurrentElementCasePane(); ElementCasePane jws = (ElementCasePane) HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getCurrentElementCasePane();
;
Grid grid = jws.getGrid(); Grid grid = jws.getGrid();
ElementCasePane reportPane = grid.getElementCasePane(); ElementCasePane reportPane = grid.getElementCasePane();
@ -93,5 +94,6 @@ public class TextBoxFloatAction extends AbstractShapeAction {
report.addFloatElement(grid.getDrawingFloatElement()); report.addFloatElement(grid.getDrawingFloatElement());
reportPane.setSelection(new FloatSelection(grid.getDrawingFloatElement().getName())); reportPane.setSelection(new FloatSelection(grid.getDrawingFloatElement().getName()));
reportPane.fireTargetModified();
} }
} }

41
designer/src/com/fr/design/cell/bar/DynamicScrollButton.java

@ -1,5 +1,6 @@
package com.fr.design.cell.bar; package com.fr.design.cell.bar;
import com.fr.design.constants.UIConstants;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import javax.swing.*; import javax.swing.*;
@ -63,48 +64,16 @@ public class DynamicScrollButton extends BasicArrowButton {
private void paintArrow(Graphics g, Dimension size) { private void paintArrow(Graphics g, Dimension size) {
switch (direction) { switch (direction) {
case SwingConstants.NORTH: case SwingConstants.NORTH:
g.drawLine(8, 5, 8, 5); g.drawImage(UIConstants.ARROW_NORTH, 0, 0, this);
g.drawLine(7, 6, 9, 6);
g.drawLine(6, 7, 10, 7);
g.drawLine(5, 8, 7, 8);
g.drawLine(9, 8, 11, 8);
g.drawLine(4, 9, 6, 9);
g.drawLine(10, 9, 12, 9);
g.drawLine(5, 10, 5, 10);
g.drawLine(11, 10, 11, 10);
break; break;
case SwingConstants.SOUTH: case SwingConstants.SOUTH:
g.drawLine(5, 6, 5, 6); g.drawImage(UIConstants.ARROW_SOUTH, 0, 0, this);
g.drawLine(11, 6, 11, 6);
g.drawLine(4, 7, 6, 7);
g.drawLine(10, 7, 12, 7);
g.drawLine(5, 8, 7, 8);
g.drawLine(9, 8, 11, 8);
g.drawLine(6, 9, 10, 9);
g.drawLine(7, 10, 9, 10);
g.drawLine(8, 11, 8, 11);
break; break;
case SwingConstants.EAST: case SwingConstants.EAST:
g.drawLine(6, 5, 6, 5); g.drawImage(UIConstants.ARROW_EAST, 0, 0, this);
g.drawLine(6, 11, 6, 11);
g.drawLine(7, 4, 7, 6);
g.drawLine(7, 10, 7, 12);
g.drawLine(8, 5, 8, 7);
g.drawLine(8, 9, 8, 11);
g.drawLine(9, 6, 9, 10);
g.drawLine(10, 7, 10, 9);
g.drawLine(11, 8, 11, 8);
break; break;
case SwingConstants.WEST: case SwingConstants.WEST:
g.drawLine(4, 8, 4, 8); g.drawImage(UIConstants.ARROW_WEST, 0, 0, this);
g.drawLine(5, 7, 5, 9);
g.drawLine(6, 6, 6, 10);
g.drawLine(7, 5, 7, 7);
g.drawLine(7, 9, 7, 11);
g.drawLine(8, 4, 8, 6);
g.drawLine(8, 10, 8, 12);
g.drawLine(9, 5, 9, 5);
g.drawLine(9, 11, 9, 11);
break; break;
} }
} }

7
designer/src/com/fr/design/cell/clipboard/CellElementsClip.java

@ -12,6 +12,7 @@ import com.fr.report.cell.CellElement;
import com.fr.report.cell.CellElementComparator; import com.fr.report.cell.CellElementComparator;
import com.fr.report.cell.TemplateCellElement; import com.fr.report.cell.TemplateCellElement;
import com.fr.report.elementcase.TemplateElementCase; import com.fr.report.elementcase.TemplateElementCase;
import com.fr.stable.StringUtils;
import com.fr.stable.unit.FU; import com.fr.stable.unit.FU;
/** /**
@ -62,9 +63,13 @@ public class CellElementsClip implements Cloneable, java.io.Serializable {
if (sbuf.length() > 0 && sbuf.charAt(sbuf.length() - 1) != '\n') { if (sbuf.length() > 0 && sbuf.charAt(sbuf.length() - 1) != '\n') {
sbuf.append('\t'); sbuf.append('\t');
} }
//REPORT-5134:会复制出null
if (cellElement.getValue() == null) {
sbuf.append(StringUtils.EMPTY);
} else {
sbuf.append(cellElement.getValue()); sbuf.append(cellElement.getValue());
} }
}
return sbuf.toString(); return sbuf.toString();
} }

2
designer/src/com/fr/design/cell/editor/AbstractCellEditor.java

@ -7,6 +7,7 @@ import java.awt.Point;
import javax.swing.event.EventListenerList; import javax.swing.event.EventListenerList;
import com.fr.design.mainframe.EastRegionContainerPane;
import com.fr.design.mainframe.ElementCasePane; import com.fr.design.mainframe.ElementCasePane;
import com.fr.grid.event.CellEditorEvent; import com.fr.grid.event.CellEditorEvent;
import com.fr.grid.event.CellEditorListener; import com.fr.grid.event.CellEditorListener;
@ -114,6 +115,7 @@ public abstract class AbstractCellEditor implements CellEditor {
} }
if(ePane != null) { if(ePane != null) {
ePane.fireSelectionChangeListener(); ePane.fireSelectionChangeListener();
EastRegionContainerPane.getInstance().switchTabTo(EastRegionContainerPane.KEY_CELL_ELEMENT);
} }
} }

10
designer/src/com/fr/design/cell/editor/FormulaCellEditor.java

@ -3,7 +3,7 @@
*/ */
package com.fr.design.cell.editor; package com.fr.design.cell.editor;
import com.fr.base.Formula; import com.fr.base.BaseFormula;
import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.formula.FormulaFactory; import com.fr.design.formula.FormulaFactory;
import com.fr.design.formula.UIFormula; import com.fr.design.formula.UIFormula;
@ -34,7 +34,7 @@ public class FormulaCellEditor extends com.fr.design.cell.editor.AbstractCellEdi
*/ */
@Override @Override
public Object getCellEditorValue() throws Exception { public Object getCellEditorValue() throws Exception {
Formula newFormula = this.formulaEditorPane.update(); BaseFormula newFormula = this.formulaEditorPane.update();
if (newFormula.getContent() != null && newFormula.getContent().trim().length() > 1) { if (newFormula.getContent() != null && newFormula.getContent().trim().length() > 1) {
return newFormula; return newFormula;
} else { } else {
@ -64,13 +64,13 @@ public class FormulaCellEditor extends com.fr.design.cell.editor.AbstractCellEdi
if (cellElement != null) { if (cellElement != null) {
value = cellElement.getValue(); value = cellElement.getValue();
} }
if (value == null || !(value instanceof Formula)) { if (value == null || !(value instanceof BaseFormula)) {
value = new Formula(""); value = BaseFormula.createFormulaBuilder().build();
} }
this.formulaEditorPane = FormulaFactory.createFormulaPaneWhenReserveFormula(); this.formulaEditorPane = FormulaFactory.createFormulaPaneWhenReserveFormula();
this.formulaEditorPane.populate((Formula) value); this.formulaEditorPane.populate((BaseFormula) value);
return this.formulaEditorPane.showLargeWindow(SwingUtilities.getWindowAncestor(grid), new DialogActionAdapter() { return this.formulaEditorPane.showLargeWindow(SwingUtilities.getWindowAncestor(grid), new DialogActionAdapter() {
@Override @Override

10
designer/src/com/fr/design/cell/editor/FormulaFloatEditor.java

@ -3,7 +3,7 @@
*/ */
package com.fr.design.cell.editor; package com.fr.design.cell.editor;
import com.fr.base.Formula; import com.fr.base.BaseFormula;
import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.formula.FormulaFactory; import com.fr.design.formula.FormulaFactory;
import com.fr.design.formula.UIFormula; import com.fr.design.formula.UIFormula;
@ -31,7 +31,7 @@ public class FormulaFloatEditor extends AbstractFloatEditor {
*/ */
@Override @Override
public Object getFloatEditorValue() throws Exception { public Object getFloatEditorValue() throws Exception {
Formula newFormula = this.formulaEditorPane.update(); BaseFormula newFormula = this.formulaEditorPane.update();
if (newFormula.getContent() != null && newFormula.getContent().trim().length() > 1) { if (newFormula.getContent() != null && newFormula.getContent().trim().length() > 1) {
return newFormula; return newFormula;
} else { } else {
@ -59,12 +59,12 @@ public class FormulaFloatEditor extends AbstractFloatEditor {
public Component getFloatEditorComponent(Grid grid, FloatElement floatElement, int resolution) { public Component getFloatEditorComponent(Grid grid, FloatElement floatElement, int resolution) {
//populate data to UI //populate data to UI
Object value = floatElement.getValue(); Object value = floatElement.getValue();
if (value == null || !(value instanceof com.fr.base.Formula)) { if (value == null || !(value instanceof BaseFormula)) {
value = new Formula(""); value = BaseFormula.createFormulaBuilder().build();
} }
this.formulaEditorPane = FormulaFactory.createFormulaPane(); this.formulaEditorPane = FormulaFactory.createFormulaPane();
this.formulaEditorPane.populate((Formula) value); this.formulaEditorPane.populate((BaseFormula) value);
return this.formulaEditorPane.showLargeWindow(SwingUtilities.getWindowAncestor(grid), new DialogActionAdapter() { return this.formulaEditorPane.showLargeWindow(SwingUtilities.getWindowAncestor(grid), new DialogActionAdapter() {

29
designer/src/com/fr/design/cell/editor/RichTextToolBar.java

@ -3,9 +3,9 @@
*/ */
package com.fr.design.cell.editor; package com.fr.design.cell.editor;
import com.fr.base.BaseFormula;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.base.Formula;
import com.fr.base.Utils; import com.fr.base.Utils;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.DialogActionAdapter;
@ -27,10 +27,27 @@ import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.*; import javax.swing.*;
import javax.swing.event.*; import javax.swing.event.CaretEvent;
import javax.swing.text.*; import javax.swing.event.CaretListener;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import javax.swing.text.AttributeSet;
import javax.swing.text.BadLocationException;
import javax.swing.text.Element;
import javax.swing.text.MutableAttributeSet;
import javax.swing.text.SimpleAttributeSet;
import javax.swing.text.StyleConstants;
import javax.swing.text.StyledDocument;
import java.awt.*; import java.awt.*;
import java.awt.event.*; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.math.BigDecimal; import java.math.BigDecimal;
/** /**
@ -311,12 +328,12 @@ public class RichTextToolBar extends BasicPane{
private ActionListener formulaActionListener = new ActionListener() { private ActionListener formulaActionListener = new ActionListener() {
public void actionPerformed(ActionEvent evt) { public void actionPerformed(ActionEvent evt) {
final UIFormula formulaPane = FormulaFactory.createFormulaPane(); final UIFormula formulaPane = FormulaFactory.createFormulaPane();
formulaPane.populate(new Formula()); formulaPane.populate(BaseFormula.createFormulaBuilder().build());
formulaPane.showLargeWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { formulaPane.showLargeWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() {
@Override @Override
public void doOk() { public void doOk() {
StyledDocument doc = (StyledDocument) textPane.getDocument(); StyledDocument doc = (StyledDocument) textPane.getDocument();
Formula fm = formulaPane.update(); BaseFormula fm = formulaPane.update();
String content = RichTextConverter.asFormula(fm.getContent()); String content = RichTextConverter.asFormula(fm.getContent());
int start = textPane.getSelectionStart(); int start = textPane.getSelectionStart();
AttributeSet attrs = start > 0 ? doc.getCharacterElement(start - 1).getAttributes() : new SimpleAttributeSet(); AttributeSet attrs = start > 0 ? doc.getCharacterElement(start - 1).getAttributes() : new SimpleAttributeSet();

2
designer/src/com/fr/design/condition/HyperlinkPane.java

@ -37,7 +37,7 @@ public class HyperlinkPane extends ConditionAttrSingleConditionPane<HighlightAct
hyperlinkButton.addActionListener(new ActionListener() { hyperlinkButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
NameJavaScriptGroup nameHyperlinks = jsGroup; NameJavaScriptGroup nameHyperlinks = jsGroup;
pane = DesignerContext.getDesignerFrame().getSelectedJTemplate().getHyperLinkPane(HyperlinkGroupPaneActionImpl.getInstance()); pane = DesignerContext.getDesignerFrame().getSelectedJTemplate().getHyperLinkPaneNoPop(HyperlinkGroupPaneActionImpl.getInstance());
pane.populate(nameHyperlinks); pane.populate(nameHyperlinks);
dialog = pane.showWindow(SwingUtilities.getWindowAncestor(conditionAttributesPane)); dialog = pane.showWindow(SwingUtilities.getWindowAncestor(conditionAttributesPane));
dialog.addDialogActionListener(new DialogActionAdapter() { dialog.addDialogActionListener(new DialogActionAdapter() {

10
designer/src/com/fr/design/condition/WidgetHighlightPane.java

@ -6,6 +6,9 @@ import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.icombobox.UIComboBox; 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.mainframe.ElementCasePane;
import com.fr.design.widget.CellWidgetCardPane;
import com.fr.design.widget.WidgetManageCardPane;
import com.fr.design.widget.WidgetPane; import com.fr.design.widget.WidgetPane;
import com.fr.form.ui.*; import com.fr.form.ui.*;
import com.fr.general.Inter; import com.fr.general.Inter;
@ -35,7 +38,12 @@ public class WidgetHighlightPane extends ConditionAttrSingleConditionPane<Highli
widgetButton = new UIButton(Inter.getLocText("FR-Designer_Edit")); widgetButton = new UIButton(Inter.getLocText("FR-Designer_Edit"));
widgetButton.addActionListener(new ActionListener() { widgetButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
final WidgetPane widgetPane = new WidgetPane(); final WidgetPane widgetPane = new WidgetPane() {
@Override
protected CellWidgetCardPane initWidgetCardPane(ElementCasePane pane) {
return new WidgetManageCardPane(pane);
}
};
widgetPane.populate(widget); widgetPane.populate(widget);
BasicDialog dialog = widgetPane.showWindow( BasicDialog dialog = widgetPane.showWindow(
SwingUtilities.getWindowAncestor(conditionAttributesPane)); SwingUtilities.getWindowAncestor(conditionAttributesPane));

29
designer/src/com/fr/design/dscolumn/DSColumnAdvancedPane.java

@ -1,11 +1,14 @@
package com.fr.design.dscolumn; package com.fr.design.dscolumn;
import com.fr.base.Formula; import com.fr.base.BaseFormula;
import com.fr.data.util.SortOrder; import com.fr.data.util.SortOrder;
import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.DesignTableDataManager;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.formula.*; import com.fr.design.formula.CustomVariableResolver;
import com.fr.design.formula.FormulaFactory;
import com.fr.design.formula.SortFormulaPane;
import com.fr.design.formula.UIFormula;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIComboBox;
@ -28,6 +31,10 @@ import java.awt.*;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import static com.fr.report.cell.cellattr.core.group.FilterTypeEnum.BOTTOM;
import static com.fr.report.cell.cellattr.core.group.FilterTypeEnum.SPECIFY;
import static com.fr.report.cell.cellattr.core.group.FilterTypeEnum.TOP;
public class DSColumnAdvancedPane extends BasicPane { public class DSColumnAdvancedPane extends BasicPane {
private static final String InsetText = " "; private static final String InsetText = " ";
@ -36,7 +43,6 @@ public class DSColumnAdvancedPane extends BasicPane {
private ValuePane valuePane; private ValuePane valuePane;
private UICheckBox horizontalExtendableCheckBox; private UICheckBox horizontalExtendableCheckBox;
private UICheckBox verticalExtendableCheckBox; private UICheckBox verticalExtendableCheckBox;
// private UICheckBox isCoverCheckBox;
private UICheckBox useMultiplyNumCheckBox; private UICheckBox useMultiplyNumCheckBox;
private UISpinner multiNumSpinner; private UISpinner multiNumSpinner;
@ -367,11 +373,11 @@ public class DSColumnAdvancedPane extends BasicPane {
if (selectCount != null) { if (selectCount != null) {
int selectCountType = selectCount.getType(); int selectCountType = selectCount.getType();
this.selectCountComboBox.setSelectedIndex(selectCountType); this.selectCountComboBox.setSelectedIndex(selectCountType);
if (selectCountType == SelectCount.TOP) { if (selectCountType == TOP.getValue()) {
this.topFormulaPane.populate(selectCount.getFormulaCount()); this.topFormulaPane.populate(selectCount.getFormulaCount());
} else if (selectCountType == SelectCount.BOTTOM) { } else if (selectCountType == BOTTOM.getValue()) {
this.bottomFormulaPane.populate(selectCount.getFormulaCount()); this.bottomFormulaPane.populate(selectCount.getFormulaCount());
} else if (selectCountType == SelectCount.SPECIFY) { } else if (selectCountType == SPECIFY.getValue()) {
this.serialTextField.setText(selectCount.getSerial()); this.serialTextField.setText(selectCount.getSerial());
} }
} }
@ -395,11 +401,11 @@ public class DSColumnAdvancedPane extends BasicPane {
SelectCount selectCount = new SelectCount(); SelectCount selectCount = new SelectCount();
dSColumn.setSelectCount(selectCount); dSColumn.setSelectCount(selectCount);
selectCount.setType(selectCountSelectIndex); selectCount.setType(selectCountSelectIndex);
if (selectCountSelectIndex == SelectCount.TOP) { if (selectCountSelectIndex == TOP.getValue()) {
selectCount.setFormulaCount(this.topFormulaPane.getFormulaText()); selectCount.setFormulaCount(this.topFormulaPane.getFormulaText());
} else if (selectCountSelectIndex == SelectCount.BOTTOM) { } else if (selectCountSelectIndex == BOTTOM.getValue()) {
selectCount.setFormulaCount(this.bottomFormulaPane.getFormulaText()); selectCount.setFormulaCount(this.bottomFormulaPane.getFormulaText());
} else if (selectCountSelectIndex == SelectCount.SPECIFY) { } else if (selectCountSelectIndex == SPECIFY.getValue()) {
selectCount.setSerial(this.serialTextField.getText()); selectCount.setSerial(this.serialTextField.getText());
} }
} }
@ -444,6 +450,7 @@ public class DSColumnAdvancedPane extends BasicPane {
public void populate(String formulaContent) { public void populate(String formulaContent) {
this.formulaTextField.setText(formulaContent); this.formulaTextField.setText(formulaContent);
} }
public void populateElement(CellElement cellElement) { public void populateElement(CellElement cellElement) {
this.cellElement = cellElement; this.cellElement = cellElement;
} }
@ -455,7 +462,7 @@ public class DSColumnAdvancedPane extends BasicPane {
private ActionListener formulaButtonActionListener = new ActionListener() { private ActionListener formulaButtonActionListener = new ActionListener() {
public void actionPerformed(ActionEvent evt) { public void actionPerformed(ActionEvent evt) {
Formula valueFormula = new Formula(); BaseFormula valueFormula = BaseFormula.createFormulaBuilder().build();
String text = formulaTextField.getText(); String text = formulaTextField.getText();
if (text == null || text.length() <= 0) { if (text == null || text.length() <= 0) {
valueFormula.setContent(defaultValue); valueFormula.setContent(defaultValue);
@ -480,7 +487,7 @@ public class DSColumnAdvancedPane extends BasicPane {
formulaPane.showLargeWindow(SwingUtilities.getWindowAncestor(JFormulaField.this), new DialogActionAdapter() { formulaPane.showLargeWindow(SwingUtilities.getWindowAncestor(JFormulaField.this), new DialogActionAdapter() {
@Override @Override
public void doOk() { public void doOk() {
Formula valueFormula = formulaPane.update(); BaseFormula valueFormula = formulaPane.update();
if (valueFormula.getContent().length() <= 1) { if (valueFormula.getContent().length() <= 1) {
formulaTextField.setText(defaultValue); formulaTextField.setText(defaultValue);
} else { } else {

2
designer/src/com/fr/design/dscolumn/DSColumnConditionsPane.java

@ -38,7 +38,7 @@ public class DSColumnConditionsPane extends BasicPane {
if (setting > DSColumnPane.SETTING_DSRELATED) { if (setting > DSColumnPane.SETTING_DSRELATED) {
liteConditionPane = new DSColumnLiteConditionPane() { liteConditionPane = new DSColumnLiteConditionPane() {
protected boolean needDoWithCondition(Condition liteCondition) { protected boolean isNeedDoWithCondition(Condition liteCondition) {
return liteCondition != null; return liteCondition != null;
} }
}; };

73
designer/src/com/fr/design/dscolumn/ResultSetGroupDockingPane.java

@ -7,7 +7,6 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
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.ElementCasePane;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.report.cell.TemplateCellElement; import com.fr.report.cell.TemplateCellElement;
@ -24,7 +23,7 @@ import java.awt.event.ItemListener;
* 这个pane是选中数据列后在上方QuickRegion处显示的pane * 这个pane是选中数据列后在上方QuickRegion处显示的pane
* *
* @author zhou, yaoh.wu * @author zhou, yaoh.wu
* @version 2017年8月2日14点55 * @version 2017年9月26日17点22
* @since 8.0 * @since 8.0
*/ */
public class ResultSetGroupDockingPane extends ResultSetGroupPane { public class ResultSetGroupDockingPane extends ResultSetGroupPane {
@ -41,12 +40,12 @@ public class ResultSetGroupDockingPane extends ResultSetGroupPane {
private ItemListener listener; private ItemListener listener;
public ResultSetGroupDockingPane(ElementCasePane ePane) { public ResultSetGroupDockingPane() {
super(); super();
this.initComponents(ePane); this.initComponents();
} }
public void initComponents(ElementCasePane ePane) { public void initComponents() {
goBox = new UIComboBox(new String[]{Inter.getLocText("BindColumn-Group"), Inter.getLocText("BindColumn-Select"), Inter.getLocText("BindColumn-Summary")}); goBox = new UIComboBox(new String[]{Inter.getLocText("BindColumn-Group"), Inter.getLocText("BindColumn-Select"), Inter.getLocText("BindColumn-Summary")});
initCardPane(); initCardPane();
contentPane = layoutPane(); contentPane = layoutPane();
@ -66,11 +65,10 @@ public class ResultSetGroupDockingPane extends ResultSetGroupPane {
}; };
goBox.addItemListener(new ItemListener() { goBox.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent ee) { public void itemStateChanged(ItemEvent ee) {
checkButtonEnabled();
int i = goBox.getSelectedIndex(); int i = goBox.getSelectedIndex();
if (i == BIND_GROUP) { if (i == BIND_GROUP) {
cardLayout.show(cardPane, "groupPane"); cardLayout.show(cardPane, "groupPane");
cardPane.setPreferredSize(new Dimension(156, 20)); cardPane.setPreferredSize(new Dimension(158, 20));
TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 2, 10); TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 2, 10);
} else if (i == BIND_SELECTED) { } else if (i == BIND_SELECTED) {
cardLayout.show(cardPane, "listPane"); cardLayout.show(cardPane, "listPane");
@ -78,11 +76,12 @@ public class ResultSetGroupDockingPane extends ResultSetGroupPane {
TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 2, 0); TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 2, 0);
} else if (i == BIND_SUMMARY) { } else if (i == BIND_SUMMARY) {
cardLayout.show(cardPane, "summaryPane"); cardLayout.show(cardPane, "summaryPane");
cardPane.setPreferredSize(new Dimension(156, 20)); cardPane.setPreferredSize(new Dimension(158, 20));
TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 2, 10); TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 2, 10);
CellExpandAttr cellExpandAttr = cellElement.getCellExpandAttr(); CellExpandAttr cellExpandAttr = cellElement.getCellExpandAttr();
cellExpandAttr.setDirection(Constants.NONE); cellExpandAttr.setDirection(Constants.NONE);
} }
checkButtonEnabled();
} }
}); });
@ -96,7 +95,6 @@ public class ResultSetGroupDockingPane extends ResultSetGroupPane {
cardLayout = new CardLayout(); cardLayout = new CardLayout();
cardPane.setLayout(cardLayout); cardPane.setLayout(cardLayout);
JPanel pane = new JPanel(new BorderLayout(3, 0));
groupComboBox.addItemListener(new ItemListener() { groupComboBox.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) { public void itemStateChanged(ItemEvent e) {
checkButtonEnabled(); checkButtonEnabled();
@ -104,7 +102,9 @@ public class ResultSetGroupDockingPane extends ResultSetGroupPane {
}); });
advancedButton = new UIButton(Inter.getLocText("Custom")); advancedButton = new UIButton(Inter.getLocText("Custom"));
advancedButton.addActionListener(groupAdvancedListener); advancedButton.addActionListener(groupAdvancedListener);
pane.add(groupComboBox, BorderLayout.WEST);
JPanel pane = new JPanel(new BorderLayout(0, 10));
pane.add(groupComboBox, BorderLayout.NORTH);
pane.add(advancedButton, BorderLayout.CENTER); pane.add(advancedButton, BorderLayout.CENTER);
cardPane.add(pane, "groupPane"); cardPane.add(pane, "groupPane");
@ -115,16 +115,16 @@ public class ResultSetGroupDockingPane extends ResultSetGroupPane {
@Override @Override
public void populate(TemplateCellElement cellElement) { public void populate(TemplateCellElement cellElement) {
//更新面板信息时可能会触发绑定在组件上的事件,先移除这些事件
this.removeListener();
this.cellElement = cellElement; this.cellElement = cellElement;
if (isNPE(cellElement)) {
if (isNPE(cellElement)) return; return;
}
DSColumn dSColumn = (DSColumn) cellElement.getValue(); DSColumn dSColumn = (DSColumn) cellElement.getValue();
// populate groupPane
// RecordGrouper
recordGrouper = dSColumn.getGrouper(); recordGrouper = dSColumn.getGrouper();
if (recordGrouper instanceof FunctionGrouper && !((FunctionGrouper) recordGrouper).isCustom()) { if (recordGrouper instanceof FunctionGrouper && !((FunctionGrouper) recordGrouper).isCustom()) {
int mode = ((FunctionGrouper) recordGrouper).getDivideMode(); int mode = recordGrouper.getDivideMode();
if (mode == FunctionGrouper.GROUPING_MODE) { if (mode == FunctionGrouper.GROUPING_MODE) {
cardLayout.show(cardPane, "groupPane"); cardLayout.show(cardPane, "groupPane");
this.goBox.setSelectedIndex(BIND_GROUP); this.goBox.setSelectedIndex(BIND_GROUP);
@ -152,15 +152,17 @@ public class ResultSetGroupDockingPane extends ResultSetGroupPane {
this.goBox.setSelectedIndex(BIND_GROUP); this.goBox.setSelectedIndex(BIND_GROUP);
this.groupComboBox.setSelectedIndex(ADVANCED); this.groupComboBox.setSelectedIndex(ADVANCED);
} }
checkButtonEnabled(); checkButtonEnabled();
//加上面板组件的交互事件监听
this.addListener();
} }
@Override @Override
public void update() { public void update() {
if (isNPE(cellElement)) return; if (isNPE(cellElement)) {
return;
}
DSColumn dSColumn = (DSColumn) cellElement.getValue(); DSColumn dSColumn = (DSColumn) cellElement.getValue();
if (this.goBox.getSelectedIndex() == BIND_GROUP) { if (this.goBox.getSelectedIndex() == BIND_GROUP) {
recordGrouper = updateGroupCombox(); recordGrouper = updateGroupCombox();
} else if (this.goBox.getSelectedIndex() == BIND_SELECTED) { } else if (this.goBox.getSelectedIndex() == BIND_SELECTED) {
@ -190,12 +192,25 @@ public class ResultSetGroupDockingPane extends ResultSetGroupPane {
advancedButton.setEnabled(true); advancedButton.setEnabled(true);
} }
} }
if (advancedButton.isEnabled()) {
cardPane.setPreferredSize(new Dimension(158, 50));
cardPane.revalidate();
cardPane.repaint();
return;
}
if (groupComboBox.isEnabled() || functionComboBox.isEnabled()) {
cardPane.setPreferredSize(new Dimension(158, 20));
cardPane.revalidate();
cardPane.repaint();
return;
} }
cardPane.setPreferredSize(new Dimension(158, 0));
cardPane.revalidate();
cardPane.repaint();
}
public void addListener(ItemListener listener) { public void setListener(ItemListener listener) {
goBox.addItemListener(listener);
groupComboBox.addItemListener(listener);
functionComboBox.addItemListener(listener);
this.listener = listener; this.listener = listener;
} }
@ -207,4 +222,16 @@ public class ResultSetGroupDockingPane extends ResultSetGroupPane {
public void setRecordGrouper(RecordGrouper recordGrouper) { public void setRecordGrouper(RecordGrouper recordGrouper) {
this.recordGrouper = recordGrouper; this.recordGrouper = recordGrouper;
} }
private void addListener() {
goBox.addItemListener(this.listener);
groupComboBox.addItemListener(this.listener);
functionComboBox.addItemListener(this.listener);
}
private void removeListener() {
goBox.removeItemListener(this.listener);
groupComboBox.removeItemListener(this.listener);
functionComboBox.removeItemListener(this.listener);
}
} }

2
designer/src/com/fr/design/dscolumn/SelectedDataColumnPane.java

@ -282,7 +282,7 @@ public class SelectedDataColumnPane extends BasicPane {
private void initWithParameterButton(final ElementCasePane casePane, final TemplateCellElement cellElement) { private void initWithParameterButton(final ElementCasePane casePane, final TemplateCellElement cellElement) {
final SelectedDataColumnPane that = this; final SelectedDataColumnPane that = this;
editorPane = new UITableEditorPane<ParameterProvider>(new ParameterTableModel()); editorPane = new UITableEditorPane<ParameterProvider>(new ParameterTableModel());
paramButton = new UIButton(Inter.getLocText("TableData_Dynamic_Parameter_Setting")); paramButton = new UIButton(Inter.getLocText("FR-Designer-Basic_Dynamic_Parameter_Injection"));
paramButton.addActionListener(new ActionListener() { paramButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
BasicDialog paramDialog = editorPane.showSmallWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { BasicDialog paramDialog = editorPane.showSmallWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() {

6
designer/src/com/fr/design/dscolumn/SpecifiedGroupAttrPane.java

@ -1,6 +1,6 @@
package com.fr.design.dscolumn; package com.fr.design.dscolumn;
import com.fr.base.Formula; import com.fr.base.BaseFormula;
import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.BasicBeanPane;
import com.fr.design.condition.DSColumnLiteConditionPane; import com.fr.design.condition.DSColumnLiteConditionPane;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
@ -333,7 +333,7 @@ public class SpecifiedGroupAttrPane extends BasicPane {
formulaButton.setPreferredSize(new Dimension(25, valueField.getPreferredSize().height)); formulaButton.setPreferredSize(new Dimension(25, valueField.getPreferredSize().height));
formulaButton.addActionListener(new ActionListener() { formulaButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) { public void actionPerformed(ActionEvent evt) {
Formula valueFormula = new Formula(); BaseFormula valueFormula = BaseFormula.createFormulaBuilder().build();
String text = valueField.getText(); String text = valueField.getText();
if (text == null || text.length() <= 0) { if (text == null || text.length() <= 0) {
valueFormula.setContent("$$$"); valueFormula.setContent("$$$");
@ -347,7 +347,7 @@ public class SpecifiedGroupAttrPane extends BasicPane {
formulaPane.showLargeWindow(SwingUtilities.getWindowAncestor(FormulaGroupPane.this), new DialogActionAdapter(){ formulaPane.showLargeWindow(SwingUtilities.getWindowAncestor(FormulaGroupPane.this), new DialogActionAdapter(){
@Override @Override
public void doOk() { public void doOk() {
Formula valueFormula = formulaPane.update(); BaseFormula valueFormula = formulaPane.update();
if (valueFormula.getContent().length() <= 1) { if (valueFormula.getContent().length() <= 1) {
valueField.setText("$$$"); valueField.setText("$$$");
} else { } else {

8
designer/src/com/fr/design/expand/SortExpandAttrPane.java

@ -24,10 +24,10 @@ public class SortExpandAttrPane extends JPanel {
public SortExpandAttrPane() { public SortExpandAttrPane() {
this.setLayout(new BorderLayout(0, 4)); this.setLayout(new BorderLayout(0, 4));
Icon[] iconArray = { Icon[][] iconArray = {
BaseUtils.readIcon("/com/fr/design/images/expand/none16x16.png"), {BaseUtils.readIcon("/com/fr/design/images/expand/none16x16.png"), BaseUtils.readIcon("/com/fr/design/images/expand/none16x16_selected@1x.png")},
BaseUtils.readIcon("/com/fr/design/images/expand/asc.png"), {BaseUtils.readIcon("/com/fr/design/images/expand/asc.png"), BaseUtils.readIcon("/com/fr/design/images/expand/asc_selected.png")},
BaseUtils.readIcon("/com/fr/design/images/expand/des.png") {BaseUtils.readIcon("/com/fr/design/images/expand/des.png"), BaseUtils.readIcon("/com/fr/design/images/expand/des_selected.png")}
}; };
String[] nameArray = { Inter.getLocText("Sort-Original"), Inter.getLocText("Sort-Ascending"), Inter.getLocText("Sort-Descending") }; String[] nameArray = { Inter.getLocText("Sort-Original"), Inter.getLocText("Sort-Ascending"), Inter.getLocText("Sort-Descending") };
sort_type_pane = new UIButtonGroup(iconArray); sort_type_pane = new UIButtonGroup(iconArray);

16
designer/src/com/fr/design/headerfooter/HFAttributesEditDialog.java

@ -3,8 +3,16 @@
*/ */
package com.fr.design.headerfooter; package com.fr.design.headerfooter;
import com.fr.base.Formula; import com.fr.base.BaseFormula;
import com.fr.base.headerfooter.*; import com.fr.base.headerfooter.DateHFElement;
import com.fr.base.headerfooter.FormulaHFElement;
import com.fr.base.headerfooter.HFElement;
import com.fr.base.headerfooter.ImageHFElement;
import com.fr.base.headerfooter.NewLineHFElement;
import com.fr.base.headerfooter.NumberOfPageHFElement;
import com.fr.base.headerfooter.PageNumberHFElement;
import com.fr.base.headerfooter.TextHFElement;
import com.fr.base.headerfooter.TimeHFElement;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.formula.FormulaFactory; import com.fr.design.formula.FormulaFactory;
@ -121,7 +129,7 @@ public class HFAttributesEditDialog extends BasicPane {
formulaButton.addActionListener(new ActionListener() { formulaButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) { public void actionPerformed(ActionEvent evt) {
Formula valueFormula = new Formula(); BaseFormula valueFormula = BaseFormula.createFormulaBuilder().build();
String text = formulaContentField.getText(); String text = formulaContentField.getText();
if (text == null || text.length() <= 0) { if (text == null || text.length() <= 0) {
valueFormula.setContent(""); valueFormula.setContent("");
@ -135,7 +143,7 @@ public class HFAttributesEditDialog extends BasicPane {
@Override @Override
public void doOk() { public void doOk() {
Formula valueFormula = formulaPane.update(); BaseFormula valueFormula = formulaPane.update();
if (valueFormula.getContent().length() <= 1) { if (valueFormula.getContent().length() <= 1) {
formulaContentField.setText(""); formulaContentField.setText("");
} else { } else {

5
designer/src/com/fr/design/mainframe/ActiveKeyGenerator.java

@ -1,7 +1,6 @@
package com.fr.design.mainframe; package com.fr.design.mainframe;
import com.fr.base.BaseUtils; import com.fr.base.ConfigManager;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.mainframe.bbs.BBSConstants;
import com.fr.general.SiteCenter; import com.fr.general.SiteCenter;
import com.fr.general.http.HttpClient; import com.fr.general.http.HttpClient;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
@ -102,7 +101,7 @@ public class ActiveKeyGenerator {
HashMap<String, String> para = new HashMap<String, String>(); HashMap<String, String> para = new HashMap<String, String>();
para.put("uuid", envManager.getUUID()); para.put("uuid", envManager.getUUID());
para.put("key", key); para.put("key", key);
para.put("username", envManager.getBBSName()); para.put("username", ConfigManager.getProviderInstance().getBbsUsername());
HttpClient hc = new HttpClient(SiteCenter.getInstance().acquireUrlByKind("verify.code"), para); HttpClient hc = new HttpClient(SiteCenter.getInstance().acquireUrlByKind("verify.code"), para);
if (timeout != -1) { if (timeout != -1) {
hc.setTimeout(timeout); hc.setTimeout(timeout);

1
designer/src/com/fr/design/mainframe/AuthorityToolBarPane.java

@ -238,7 +238,6 @@ public class AuthorityToolBarPane<T extends WebContent> extends BasicBeanPane<Re
dealWithWebContent(webAttr.getWebView(), widget, isSelected, selectedRole); dealWithWebContent(webAttr.getWebView(), widget, isSelected, selectedRole);
} }
} }
} }
private void dealWithWebContent(WebContent wc, Widget widget, boolean isSelected, String selectedRole) { private void dealWithWebContent(WebContent wc, Widget widget, boolean isSelected, String selectedRole) {

8
designer/src/com/fr/design/mainframe/CellElementPropertyPane.java

@ -79,7 +79,7 @@ public class CellElementPropertyPane extends DockingView {
@Override @Override
public void fireTitleChange(String addName) { public void fireTitleChange(String addName) {
title.setText(Inter.getLocText("CellElement-Property_Table") + '-' + addName); title.setText(Inter.getLocText("FR-Designer_CellElement_Property_Table") + '-' + addName);
} }
}; };
@ -134,8 +134,7 @@ public class CellElementPropertyPane extends DockingView {
} }
public void reInit(ElementCasePane ePane) { public void reInit(ElementCasePane ePane) {
if (titlePane.getParent() == null) { // 如果处于隐藏状态,则让其显示 if (cellElementEditPane.getParent() == null) { // 如果处于隐藏状态,则让其显示
// this.add(titlePane, BorderLayout.NORTH);
this.add(cellElementEditPane, BorderLayout.CENTER); this.add(cellElementEditPane, BorderLayout.CENTER);
} }
cellElementEditPane.populate(ePane); cellElementEditPane.populate(ePane);
@ -151,7 +150,7 @@ public class CellElementPropertyPane extends DockingView {
@Override @Override
public String getViewTitle() { public String getViewTitle() {
return Inter.getLocText("CellElement-Property_Table"); return Inter.getLocText("FR-Designer_CellElement_Property_Table");
} }
@Override @Override
@ -176,6 +175,7 @@ public class CellElementPropertyPane extends DockingView {
*/ */
public void GoToPane(String... id) { public void GoToPane(String... id) {
cellElementEditPane.setSelectedIndex(id); cellElementEditPane.setSelectedIndex(id);
EastRegionContainerPane.getInstance().switchTabTo(EastRegionContainerPane.KEY_CELL_ATTR);
EastRegionContainerPane.getInstance().setWindow2PreferWidth(); EastRegionContainerPane.getInstance().setWindow2PreferWidth();
} }

48
designer/src/com/fr/design/mainframe/CellWidgetPropertyPane.java

@ -1,20 +1,18 @@
package com.fr.design.mainframe; package com.fr.design.mainframe;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.design.dialog.BasicDialog; import com.fr.design.actions.utils.ReportActionUtils;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.present.CellWriteAttrPane;
import com.fr.design.widget.WidgetPane; import com.fr.design.widget.WidgetPane;
import com.fr.form.ui.NoneWidget; import com.fr.form.ui.NoneWidget;
import com.fr.form.ui.Widget; import com.fr.form.ui.Widget;
import com.fr.general.FRLogger; import com.fr.general.FRLogger;
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.grid.selection.FloatSelection;
import com.fr.grid.selection.Selection; import com.fr.grid.selection.Selection;
import com.fr.privilege.finegrain.WidgetPrivilegeControl; import com.fr.privilege.finegrain.WidgetPrivilegeControl;
import com.fr.report.cell.CellElement;
import com.fr.report.cell.DefaultTemplateCellElement; import com.fr.report.cell.DefaultTemplateCellElement;
import com.fr.report.cell.TemplateCellElement; import com.fr.report.cell.TemplateCellElement;
import com.fr.report.elementcase.TemplateElementCase; import com.fr.report.elementcase.TemplateElementCase;
@ -30,6 +28,7 @@ public class CellWidgetPropertyPane extends BasicPane {
private TemplateCellElement cellElement; private TemplateCellElement cellElement;
private WidgetPane cellEditorDefPane; private WidgetPane cellEditorDefPane;
private ElementCasePane ePane;
public static CellWidgetPropertyPane getInstance() { public static CellWidgetPropertyPane getInstance() {
if (singleton == null) { if (singleton == null) {
@ -40,8 +39,6 @@ public class CellWidgetPropertyPane extends BasicPane {
public CellWidgetPropertyPane() { public CellWidgetPropertyPane() {
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
// this.addAttributeChangeListener(listener);
// cellEditorDefPane = new WidgetPane(elementCasePane);
} }
public void clear() { public void clear() {
@ -78,12 +75,13 @@ public class CellWidgetPropertyPane extends BasicPane {
FRContext.getLogger().error(e.getMessage(), e); FRContext.getLogger().error(e.getMessage(), e);
} }
} }
cellEditorDefPane.populate(cellWidget);
cellEditorDefPane.populate(cellWidget);
} }
public void reInit(ElementCasePane ePane) { public void reInit(ElementCasePane ePane) {
this.ePane = ePane;
cellEditorDefPane = new WidgetPane(ePane); cellEditorDefPane = new WidgetPane(ePane);
this.removeAll(); this.removeAll();
this.add(cellEditorDefPane, BorderLayout.CENTER); this.add(cellEditorDefPane, BorderLayout.CENTER);
@ -93,7 +91,6 @@ public class CellWidgetPropertyPane extends BasicPane {
TemplateCellElement editCellElement = tplEC.getTemplateCellElement(cs.getColumn(), cs.getRow()); TemplateCellElement editCellElement = tplEC.getTemplateCellElement(cs.getColumn(), cs.getRow());
if (editCellElement == null) { if (editCellElement == null) {
editCellElement = new DefaultTemplateCellElement(cs.getColumn(), cs.getRow()); editCellElement = new DefaultTemplateCellElement(cs.getColumn(), cs.getRow());
tplEC.addCellElement(editCellElement);
} }
this.cellElement = editCellElement; this.cellElement = editCellElement;
this.populate(editCellElement); this.populate(editCellElement);
@ -105,12 +102,32 @@ public class CellWidgetPropertyPane extends BasicPane {
} }
public void update() { public void update() {
if (cellElement == null) {// 利用默认的CellElement. if (cellElement == null || !cellEditorDefPane.isShouldFireSelectedEvent()) {
return; return;
} }
final CellSelection finalCS = (CellSelection) ePane.getSelection();
Widget cellWidget = this.cellEditorDefPane.update(); final TemplateElementCase tplEC = ePane.getEditingElementCase();
if(finalCS.isSelectedOneCell(ePane)){
if(tplEC.getTemplateCellElement(cellElement.getColumn(), cellElement.getRow())== null){//cellElement未加入到report中时要添加进去
tplEC.addCellElement(cellElement);
}
setCellWidget(cellElement);
}else{
ReportActionUtils.actionIterateWithCellSelection(finalCS, tplEC, new ReportActionUtils.IterAction() {
public void dealWith(CellElement editCellElement) {
// p:最后把这个cellEditorDef设置到CellGUIAttr. // p:最后把这个cellEditorDef设置到CellGUIAttr.
TemplateCellElement templateCellElement = (TemplateCellElement) editCellElement;
setCellWidget(templateCellElement);
}
});
}
if(DesignerContext.getDesignerFrame().getSelectedJTemplate() != null){
DesignerContext.getDesignerFrame().getSelectedJTemplate().fireTargetModified();
}
}
private void setCellWidget(TemplateCellElement cellElement){
Widget cellWidget = cellEditorDefPane.update();
if (cellWidget instanceof NoneWidget) { if (cellWidget instanceof NoneWidget) {
cellElement.setWidget(null); cellElement.setWidget(null);
} else { } else {
@ -119,9 +136,11 @@ public class CellWidgetPropertyPane extends BasicPane {
} }
cellElement.setWidget(cellWidget); cellElement.setWidget(cellWidget);
} }
} }
public void reInitAllListener(){
cellEditorDefPane.registerListener();
}
private Widget upDateWidgetAuthority(TemplateCellElement cellElement, Widget newWidget) { private Widget upDateWidgetAuthority(TemplateCellElement cellElement, Widget newWidget) {
try { try {
@ -135,14 +154,15 @@ public class CellWidgetPropertyPane extends BasicPane {
return newWidget; return newWidget;
} }
@Override
/** /**
* 检测是否有效 * 检测是否有效
*
* @throws Exception e
*/ */
@Override
public void checkValid() throws Exception { public void checkValid() throws Exception {
this.cellEditorDefPane.checkValid(); this.cellEditorDefPane.checkValid();
} }
} }

97
designer/src/com/fr/design/mainframe/ElementCasePane.java

@ -3,34 +3,7 @@
*/ */
package com.fr.design.mainframe; package com.fr.design.mainframe;
import java.awt.AWTEvent; import com.fr.base.*;
import java.awt.Adjustable;
import java.awt.Dimension;
import java.awt.Image;
import java.awt.Rectangle;
import java.awt.datatransfer.Clipboard;
import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.Transferable;
import java.awt.event.*;
import java.lang.reflect.Constructor;
import java.util.Set;
import javax.swing.AbstractAction;
import javax.swing.ActionMap;
import javax.swing.Icon;
import javax.swing.InputMap;
import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import javax.swing.JScrollBar;
import javax.swing.KeyStroke;
import com.fr.base.BaseUtils;
import com.fr.base.DynamicUnitList;
import com.fr.base.FRContext;
import com.fr.base.Formula;
import com.fr.base.ScreenResolution;
import com.fr.base.Style;
import com.fr.design.DesignState; import com.fr.design.DesignState;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.ExtraDesignClassManager; import com.fr.design.ExtraDesignClassManager;
@ -39,30 +12,8 @@ import com.fr.design.actions.ExitAuthorityEditAction;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.actions.cell.BorderAction; import com.fr.design.actions.cell.BorderAction;
import com.fr.design.actions.cell.CleanAuthorityAction; import com.fr.design.actions.cell.CleanAuthorityAction;
import com.fr.design.actions.cell.style.AlignmentAction; import com.fr.design.actions.cell.style.*;
import com.fr.design.actions.cell.style.ReportFontBoldAction; import com.fr.design.actions.columnrow.*;
import com.fr.design.actions.cell.style.ReportFontForegroundAction;
import com.fr.design.actions.cell.style.ReportFontItalicAction;
import com.fr.design.actions.cell.style.ReportFontNameAction;
import com.fr.design.actions.cell.style.ReportFontSizeAction;
import com.fr.design.actions.cell.style.ReportFontUnderlineAction;
import com.fr.design.actions.cell.style.StyleBackgroundAction;
import com.fr.design.actions.columnrow.CancelColumnAction;
import com.fr.design.actions.columnrow.CancelRowAction;
import com.fr.design.actions.columnrow.ColumnHideAction;
import com.fr.design.actions.columnrow.ColumnWidthAction;
import com.fr.design.actions.columnrow.DeleteColumnAction;
import com.fr.design.actions.columnrow.DeleteRowAction;
import com.fr.design.actions.columnrow.FootColumnAction;
import com.fr.design.actions.columnrow.FootRowAction;
import com.fr.design.actions.columnrow.HeadColumnAction;
import com.fr.design.actions.columnrow.HeadRowAction;
import com.fr.design.actions.columnrow.InsertColumnAction;
import com.fr.design.actions.columnrow.InsertRowAction;
import com.fr.design.actions.columnrow.ResetColumnHideAction;
import com.fr.design.actions.columnrow.ResetRowHideAction;
import com.fr.design.actions.columnrow.RowHeightAction;
import com.fr.design.actions.columnrow.RowHideAction;
import com.fr.design.actions.core.ActionFactory; import com.fr.design.actions.core.ActionFactory;
import com.fr.design.actions.edit.CopyAction; import com.fr.design.actions.edit.CopyAction;
import com.fr.design.actions.edit.CutAction; import com.fr.design.actions.edit.CutAction;
@ -74,6 +25,7 @@ import com.fr.design.cell.clipboard.CellElementsClip;
import com.fr.design.cell.clipboard.ElementsTransferable; import com.fr.design.cell.clipboard.ElementsTransferable;
import com.fr.design.cell.clipboard.FloatElementsClip; import com.fr.design.cell.clipboard.FloatElementsClip;
import com.fr.design.cell.editor.*; import com.fr.design.cell.editor.*;
import com.fr.design.cell.editor.CellEditor;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.designer.EditingState; import com.fr.design.designer.EditingState;
import com.fr.design.designer.TargetComponent; import com.fr.design.designer.TargetComponent;
@ -83,11 +35,7 @@ import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.imenu.UIPopupMenu; import com.fr.design.gui.imenu.UIPopupMenu;
import com.fr.design.mainframe.cell.QuickEditorRegion; import com.fr.design.mainframe.cell.QuickEditorRegion;
import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus; import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus;
import com.fr.design.menu.KeySetUtils; import com.fr.design.menu.*;
import com.fr.design.menu.MenuDef;
import com.fr.design.menu.NameSeparator;
import com.fr.design.menu.ShortCut;
import com.fr.design.menu.ToolBarDef;
import com.fr.design.selection.QuickEditor; import com.fr.design.selection.QuickEditor;
import com.fr.design.selection.Selectedable; import com.fr.design.selection.Selectedable;
import com.fr.design.selection.SelectionEvent; import com.fr.design.selection.SelectionEvent;
@ -95,11 +43,7 @@ import com.fr.design.selection.SelectionListener;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.FRLogger; import com.fr.general.FRLogger;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.grid.Grid; import com.fr.grid.*;
import com.fr.grid.GridColumn;
import com.fr.grid.GridCorner;
import com.fr.grid.GridRow;
import com.fr.grid.GridUtils;
import com.fr.grid.dnd.ElementCasePaneDropTarget; import com.fr.grid.dnd.ElementCasePaneDropTarget;
import com.fr.grid.selection.CellSelection; import com.fr.grid.selection.CellSelection;
import com.fr.grid.selection.Selection; import com.fr.grid.selection.Selection;
@ -119,9 +63,17 @@ import com.fr.report.elementcase.ElementCase;
import com.fr.report.elementcase.TemplateElementCase; import com.fr.report.elementcase.TemplateElementCase;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.ColumnRow; import com.fr.stable.ColumnRow;
import com.fr.stable.Constants;
import com.fr.stable.unit.FU; import com.fr.stable.unit.FU;
import javax.swing.*;
import java.awt.*;
import java.awt.datatransfer.Clipboard;
import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.Transferable;
import java.awt.event.*;
import java.lang.reflect.Constructor;
import java.util.Set;
import static com.fr.design.gui.syntax.ui.rtextarea.RTADefaultInputMap.DEFAULT_MODIFIER; import static com.fr.design.gui.syntax.ui.rtextarea.RTADefaultInputMap.DEFAULT_MODIFIER;
/** /**
@ -243,7 +195,6 @@ public abstract class ElementCasePane<T extends TemplateElementCase> extends Tar
} }
public int getMenuState() { public int getMenuState() {
return DesignState.WORK_SHEET; return DesignState.WORK_SHEET;
} }
@ -371,7 +322,7 @@ public abstract class ElementCasePane<T extends TemplateElementCase> extends Tar
private void initDefaultEditors() { private void initDefaultEditors() {
Grid grid = this.getGrid(); Grid grid = this.getGrid();
grid.setDefaultCellEditor(DSColumn.class, new DSColumnCellEditor(this)); grid.setDefaultCellEditor(DSColumn.class, new DSColumnCellEditor(this));
grid.setDefaultCellEditor(Formula.class, new FormulaCellEditor(this)); grid.setDefaultCellEditor(BaseFormula.class, new FormulaCellEditor(this));
grid.setDefaultCellEditor(RichText.class, new RichTextCellEditor(this)); grid.setDefaultCellEditor(RichText.class, new RichTextCellEditor(this));
grid.setDefaultCellEditor(BiasTextPainter.class, new BiasTextPainterCellEditor(this)); grid.setDefaultCellEditor(BiasTextPainter.class, new BiasTextPainterCellEditor(this));
@ -1268,11 +1219,7 @@ public abstract class ElementCasePane<T extends TemplateElementCase> extends Tar
protected ToolBarDef createAlignmentToolBar() { protected ToolBarDef createAlignmentToolBar() {
return ShortCut.asToolBarDef(new ShortCut[]{ return ShortCut.asToolBarDef(new ShortCut[]{
new AlignmentAction(this, new Icon[]{ new AlignmentAction(this)}
BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_left_normal.png"),
BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_center_normal.png"),
BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_right_normal.png")},
new Integer[]{Constants.LEFT, Constants.CENTER, Constants.RIGHT})}
); );
} }
@ -1325,7 +1272,7 @@ public abstract class ElementCasePane<T extends TemplateElementCase> extends Tar
* @return 返回正在编辑的状态. * @return 返回正在编辑的状态.
*/ */
public EditingState createEditingState() { public EditingState createEditingState() {
return new ElementCaseEditingState(this.selection, this.verScrollBar.getValue(), this.horScrollBar.getValue()); return new ElementCaseEditingState(this.selection, this.verScrollBar.getValue(), this.horScrollBar.getValue(), this.resolution);
} }
public void setCellNeedTOFormat(CellSelection selection) { public void setCellNeedTOFormat(CellSelection selection) {
@ -1341,15 +1288,18 @@ public abstract class ElementCasePane<T extends TemplateElementCase> extends Tar
protected Selection selection; protected Selection selection;
protected int verticalValue = 0; protected int verticalValue = 0;
protected int horizontalValue = 0; protected int horizontalValue = 0;
protected int resolution = ScreenResolution.getScreenResolution();
protected ElementCaseEditingState(Selection selection, int verticalValue, int horizontalValue) { protected ElementCaseEditingState(Selection selection, int verticalValue, int horizontalValue, int resolution) {
try { try {
this.selection = selection.clone(); this.selection = selection.clone();
this.resolution = resolution;
} catch (CloneNotSupportedException e) { } catch (CloneNotSupportedException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
this.verticalValue = verticalValue; this.verticalValue = verticalValue;
this.horizontalValue = horizontalValue; this.horizontalValue = horizontalValue;
this.resolution = resolution;
} }
@Override @Override
@ -1363,7 +1313,8 @@ public abstract class ElementCasePane<T extends TemplateElementCase> extends Tar
ElementCasePane.this.getVerticalScrollBar().setValue(this.verticalValue); ElementCasePane.this.getVerticalScrollBar().setValue(this.verticalValue);
ElementCasePane.this.getHorizontalScrollBar().setValue(this.horizontalValue); ElementCasePane.this.getHorizontalScrollBar().setValue(this.horizontalValue);
// ElementCasePane.this.setResolution(this.resolution);
HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().setScale(this.resolution);
// 重绘. // 重绘.
ElementCasePane.this.repaint(); ElementCasePane.this.repaint();
} }

44
designer/src/com/fr/design/mainframe/ElementCasePaneDelegate.java

@ -1,6 +1,7 @@
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.fun.MenuHandler;
import com.fr.design.gui.frpane.HyperlinkGroupPane; import com.fr.design.gui.frpane.HyperlinkGroupPane;
import com.fr.design.menu.KeySetUtils; import com.fr.design.menu.KeySetUtils;
@ -44,9 +45,27 @@ public class ElementCasePaneDelegate extends ElementCasePane<WorkSheet> {
public ElementCasePaneDelegate(WorkSheet sheet) { public ElementCasePaneDelegate(WorkSheet sheet) {
super(sheet); super(sheet);
this.addSelectionChangeListener(new SelectionListener() { this.addSelectionChangeListener(new SelectionListener() {
@Override @Override
public void selectionChanged(SelectionEvent e) { public void selectionChanged(SelectionEvent e) {
if (!isEditable() && !BaseUtils.isAuthorityEditing()) {
return;
}
refreshPropertyPanes();
}
});
this.addTargetModifiedListener(new TargetModifiedListener() {
@Override
public void targetModified(TargetModifiedEvent e) {
if (DesignerContext.isRefreshOnTargetModifiedEnabled()) {
refreshPropertyPanes();
} else {
CellElementPropertyPane.getInstance().populate(ElementCasePaneDelegate.this);
}
}
});
}
private void refreshPropertyPanes() {
//在编辑权限,所以要更新权限编辑面板 //在编辑权限,所以要更新权限编辑面板
if (BaseUtils.isAuthorityEditing()) { if (BaseUtils.isAuthorityEditing()) {
AuthorityPropertyPane authorityPropertyPane = new AuthorityPropertyPane(ElementCasePaneDelegate.this); AuthorityPropertyPane authorityPropertyPane = new AuthorityPropertyPane(ElementCasePaneDelegate.this);
@ -56,12 +75,14 @@ public class ElementCasePaneDelegate extends ElementCasePane<WorkSheet> {
EastRegionContainerPane.getInstance().replaceConfiguredRolesPane(RolesAlreadyEditedPane.getInstance()); EastRegionContainerPane.getInstance().replaceConfiguredRolesPane(RolesAlreadyEditedPane.getInstance());
return; return;
} }
if (DesignerContext.getDesignerFrame().getSelectedJTemplate() != null) {
CellWidgetPropertyPane.getInstance().populate(ElementCasePaneDelegate.this); CellWidgetPropertyPane.getInstance().populate(ElementCasePaneDelegate.this);
}
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 = ((ElementCasePaneDelegate)e.getSource()).getSelection(); Selection editingSelection = getSelection();
// 模板初始化完成后,才能初始化超级链接面板 // 模板初始化完成后,才能初始化超级链接面板
HyperlinkGroupPane hyperlinkGroupPane = editingTemplate.getHyperLinkPane(HyperlinkGroupPaneActionImpl.getInstance()); HyperlinkGroupPane hyperlinkGroupPane = editingTemplate.getHyperLinkPane(HyperlinkGroupPaneActionImpl.getInstance());
hyperlinkGroupPane.populate(ElementCasePaneDelegate.this); hyperlinkGroupPane.populate(ElementCasePaneDelegate.this);
@ -82,19 +103,13 @@ public class ElementCasePaneDelegate extends ElementCasePane<WorkSheet> {
EastRegionContainerPane.getInstance().replaceCellElementPane(QuickEditorRegion.getInstance()); EastRegionContainerPane.getInstance().replaceCellElementPane(QuickEditorRegion.getInstance());
EastRegionContainerPane.getInstance().replaceConditionAttrPane(conditionAttributesGroupPane); EastRegionContainerPane.getInstance().replaceConditionAttrPane(conditionAttributesGroupPane);
EastRegionContainerPane.getInstance().replaceWidgetSettingsPane(CellWidgetPropertyPane.getInstance()); EastRegionContainerPane.getInstance().replaceWidgetSettingsPane(CellWidgetPropertyPane.getInstance());
EastRegionContainerPane.getInstance().updateCellElementState(isSelectedOneCell());
} }
EastRegionContainerPane.getInstance().replaceHyperlinkPane(hyperlinkGroupPane); EastRegionContainerPane.getInstance().replaceHyperlinkPane(hyperlinkGroupPane);
EastRegionContainerPane.getInstance().removeParameterPane(); EastRegionContainerPane.getInstance().removeParameterPane();
} }
} }
});
this.addTargetModifiedListener(new TargetModifiedListener() {
@Override
public void targetModified(TargetModifiedEvent e) {
CellElementPropertyPane.getInstance().populate(ElementCasePaneDelegate.this);
}
});
}
@Override @Override
protected boolean supportRepeatedHeaderFooter() { protected boolean supportRepeatedHeaderFooter() {
@ -122,6 +137,7 @@ public class ElementCasePaneDelegate extends ElementCasePane<WorkSheet> {
* *
* @return 不是必须在可见范围. * @return 不是必须在可见范围.
*/ */
@Override
public boolean mustInVisibleRange() { public boolean mustInVisibleRange() {
return false; return false;
} }
@ -162,6 +178,9 @@ public class ElementCasePaneDelegate extends ElementCasePane<WorkSheet> {
for (int i = 0; i < actions.length; i++) { for (int i = 0; i < actions.length; i++) {
subMenuDef.addShortCut(actions[i]); subMenuDef.addShortCut(actions[i]);
} }
// 顺便更新右侧属性面板悬浮元素tab中的菜单项
ReportFloatPane.getInstance().refreshInsertFloatMenu(this);
} }
// 格式菜单 // 格式菜单
@ -169,12 +188,13 @@ public class ElementCasePaneDelegate extends ElementCasePane<WorkSheet> {
MenuDef menuDef = new MenuDef(KeySetUtils.CELL.getMenuKeySetName(), KeySetUtils.CELL.getMnemonic()); MenuDef menuDef = new MenuDef(KeySetUtils.CELL.getMenuKeySetName(), KeySetUtils.CELL.getMnemonic());
menuDef.addShortCut(new CellExpandAttrAction()); menuDef.addShortCut(new CellExpandAttrAction());
menuDef.addShortCut(new CellWidgetAttrAction(this));
menuDef.addShortCut(new GlobalStyleMenuDef(this)); menuDef.addShortCut(new GlobalStyleMenuDef(this));
// 单元格形态 // 单元格形态
menuDef.addShortCut(DeprecatedActionManager.getPresentMenu(this)); menuDef.addShortCut(DeprecatedActionManager.getPresentMenu(this));
menuDef.addShortCut(new CellWidgetAttrAction());
menuDef.addShortCut(new ConditionAttributesAction());
menuDef.addShortCut(new HyperlinkAction());
menuDef.addShortCut(SeparatorDef.DEFAULT); menuDef.addShortCut(SeparatorDef.DEFAULT);
menuDef.addShortCut(new MergeCellAction(this)); menuDef.addShortCut(new MergeCellAction(this));
menuDef.addShortCut(new UnmergeCellAction(this)); menuDef.addShortCut(new UnmergeCellAction(this));

71
designer/src/com/fr/design/mainframe/InformationCollector.java

@ -3,6 +3,7 @@
*/ */
package com.fr.design.mainframe; package com.fr.design.mainframe;
import com.fr.base.ConfigManagerFactory;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.data.core.db.DBUtils; import com.fr.data.core.db.DBUtils;
import com.fr.data.core.db.dialect.DialectFactory; import com.fr.data.core.db.dialect.DialectFactory;
@ -12,23 +13,51 @@ import com.fr.data.core.db.dml.Table;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.mainframe.errorinfo.ErrorInfoUploader; import com.fr.design.mainframe.errorinfo.ErrorInfoUploader;
import com.fr.design.mainframe.templateinfo.TemplateInfoCollector; import com.fr.design.mainframe.templateinfo.TemplateInfoCollector;
import com.fr.general.*; import com.fr.general.ComparatorUtils;
import com.fr.general.DateUtils;
import com.fr.general.DesUtils;
import com.fr.general.GeneralUtils;
import com.fr.general.IOUtils;
import com.fr.general.SiteCenter;
import com.fr.general.http.HttpClient; import com.fr.general.http.HttpClient;
import com.fr.json.JSONArray; import com.fr.json.JSONArray;
import com.fr.json.JSONException; import com.fr.json.JSONException;
import com.fr.record.DBRecordManager; import com.fr.json.JSONObject;
import com.fr.stable.*; import com.fr.record.DBRecordXManager;
import com.fr.stable.xml.*; import com.fr.stable.ArrayUtils;
import com.fr.stable.EncodeConstants;
import com.fr.stable.ProductConstants;
import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils;
import com.fr.stable.xml.XMLPrintWriter;
import com.fr.stable.xml.XMLReadable;
import com.fr.stable.xml.XMLTools;
import com.fr.stable.xml.XMLWriter;
import com.fr.stable.xml.XMLableReader;
import com.fr.third.javax.xml.stream.XMLStreamException; import com.fr.third.javax.xml.stream.XMLStreamException;
import org.json.JSONObject;
import java.io.*; import java.io.BufferedWriter;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.UnsupportedEncodingException;
import java.sql.Connection; import java.sql.Connection;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import java.text.DateFormat; import java.text.DateFormat;
import java.util.*; import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/** /**
* @author neil * @author neil
@ -125,18 +154,22 @@ public class InformationCollector implements XMLReadable, XMLWriter {
JSONArray startStopArray = new JSONArray(); JSONArray startStopArray = new JSONArray();
for (int i = 0; i < startStop.size(); i++) { for (int i = 0; i < startStop.size(); i++) {
JSONObject jo = new JSONObject(); JSONObject jo = new JSONObject();
try {
jo.put(ATTR_START, startStop.get(i).getStartDate()); jo.put(ATTR_START, startStop.get(i).getStartDate());
jo.put(ATTR_STOP, startStop.get(i).getStopDate()); jo.put(ATTR_STOP, startStop.get(i).getStopDate());
startStopArray.put(jo); startStopArray.put(jo);
}
DesignerEnvManager envManager = DesignerEnvManager.getEnvManager(); DesignerEnvManager envManager = DesignerEnvManager.getEnvManager();
content.put(XML_START_STOP, startStopArray); content.put(XML_START_STOP, startStopArray);
content.put(XML_UUID, envManager.getUUID()); content.put(XML_UUID, envManager.getUUID());
content.put(XML_JAR, GeneralUtils.readBuildNO()); content.put(XML_JAR, GeneralUtils.readBuildNO());
content.put(XML_VERSION, ProductConstants.RELEASE_VERSION); content.put(XML_VERSION, ProductConstants.RELEASE_VERSION);
content.put(XML_USERNAME, envManager.getBBSName()); content.put(XML_USERNAME, ConfigManagerFactory.getProviderInstance().getBbsUsername());
content.put(XML_KEY, envManager.getActivationKey()); content.put(XML_KEY, envManager.getActivationKey());
content.put(XML_OS, System.getProperty("os.name")); content.put(XML_OS, System.getProperty("os.name"));
} catch (JSONException e) {
FRContext.getLogger().error(e.getMessage(), e);
}
}
try { try {
return content.toString().getBytes(EncodeConstants.ENCODING_UTF_8); return content.toString().getBytes(EncodeConstants.ENCODING_UTF_8);
@ -161,7 +194,12 @@ public class InformationCollector implements XMLReadable, XMLWriter {
} }
String res = hc.getResponseText(); String res = hc.getResponseText();
//服务器返回true,说明已经取得成功,清空当前记录的信息 //服务器返回true,说明已经取得成功,清空当前记录的信息
boolean success = ComparatorUtils.equals(new JSONObject(res).get("status"), "success"); boolean success = false;
try {
success = ComparatorUtils.equals(new JSONObject(res).get("status"), "success");
} catch (JSONException e) {
FRContext.getLogger().error(e.getMessage(), e);
}
if (success){ if (success){
this.reset(); this.reset();
} }
@ -179,7 +217,7 @@ public class InformationCollector implements XMLReadable, XMLWriter {
Table table = new Table(TABLE_NAME); Table table = new Table(TABLE_NAME);
try { try {
conn = DBRecordManager.getDB().createConnection(); conn = DBRecordXManager.getDB().createConnection();
ResultSet rs = selectAllFromLogDB(conn, table); ResultSet rs = selectAllFromLogDB(conn, table);
if(rs == null){ if(rs == null){
@ -201,7 +239,12 @@ public class InformationCollector implements XMLReadable, XMLWriter {
} }
String res = httpClient.getResponseText(); String res = httpClient.getResponseText();
boolean success = ComparatorUtils.equals(new JSONObject(res).get("status"), "success"); boolean success = false;
try {
success = ComparatorUtils.equals(new JSONObject(res).get("status"), "success");
} catch (JSONException e) {
FRContext.getLogger().error(e.getMessage(), e);
}
//服务器返回true, 说明已经获取成功, 清空当前记录的信息 //服务器返回true, 说明已经获取成功, 清空当前记录的信息
if (success) { if (success) {
deleteLogDB(conn, table); deleteLogDB(conn, table);
@ -211,7 +254,7 @@ public class InformationCollector implements XMLReadable, XMLWriter {
private void deleteLogDB(Connection conn, Table table) { private void deleteLogDB(Connection conn, Table table) {
try { try {
conn = DBRecordManager.getDB().createConnection(); conn = DBRecordXManager.getDB().createConnection();
Delete delete = new Delete(table); Delete delete = new Delete(table);
delete.execute(conn); delete.execute(conn);
} catch (Exception e) { } catch (Exception e) {
@ -254,7 +297,7 @@ public class InformationCollector implements XMLReadable, XMLWriter {
} }
DesignerEnvManager envManager = DesignerEnvManager.getEnvManager(); DesignerEnvManager envManager = DesignerEnvManager.getEnvManager();
content.put("username", envManager.getBBSName()); content.put("username", ConfigManagerFactory.getProviderInstance().getBbsUsername());
content.put("uuid", envManager.getUUID()); content.put("uuid", envManager.getUUID());
content.put("functions", functionArray); content.put("functions", functionArray);

20
designer/src/com/fr/design/mainframe/JWorkBook.java

@ -92,7 +92,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
private UIModeControlContainer centerPane; private UIModeControlContainer centerPane;
public ReportComponentComposite reportComposite; public ReportComponentComposite reportComposite;
private ParameterDefinitePane parameterPane; private ParameterDefinitePane parameterPane;
private int resolution; private int resolution = ScreenResolution.getScreenResolution();
public JWorkBook() { public JWorkBook() {
super(new WorkBook(new WorkSheet()), "WorkBook"); super(new WorkBook(new WorkSheet()), "WorkBook");
@ -113,12 +113,15 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
public void refreshEastPropertiesPane() { public void refreshEastPropertiesPane() {
if (isEditingPolySheet()) { if (isEditingPolySheet()) {
EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.POLY); EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.POLY);
} else {
if (isUpMode()) {
EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.REPORT_PARA);
} else { } else {
EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.REPORT); EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.REPORT);
EastRegionContainerPane.getInstance().replaceCellElementPane(getEastUpPane());
EastRegionContainerPane.getInstance().replaceCellAttrPane(getEastDownPane());
} }
} }
refreshToolArea();
}
private boolean isEditingPolySheet() { private boolean isEditingPolySheet() {
return template.getReport(getEditingReportIndex()) instanceof PolyWorkSheet; return template.getReport(getEditingReportIndex()) instanceof PolyWorkSheet;
@ -129,6 +132,11 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
return getEditingElementCasePane(); return getEditingElementCasePane();
} }
@Override
public JComponent getCurrentReportComponentPane() {
return reportComposite;
}
@Override @Override
protected UIModeControlContainer createCenterPane() { protected UIModeControlContainer createCenterPane() {
parameterPane = ModuleContext.isModuleStarted(Module.FORM_MODULE) ? new ParameterDefinitePane() : null; parameterPane = ModuleContext.isModuleStarted(Module.FORM_MODULE) ? new ParameterDefinitePane() : null;
@ -394,7 +402,6 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().setJTemplateResolution(resolution); HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().setJTemplateResolution(resolution);
polyDezi.updateUI(); polyDezi.updateUI();
} }
HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().fireTargetModified();
} }
@Override @Override
@ -854,6 +861,11 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
return ReportHyperlinkGroupPane.getInstance(hyperlinkGroupPaneActionProvider); return ReportHyperlinkGroupPane.getInstance(hyperlinkGroupPaneActionProvider);
} }
@Override
public HyperlinkGroupPane getHyperLinkPaneNoPop(HyperlinkGroupPaneActionProvider hyperlinkGroupPaneActionProvider) {
return ReportHyperlinkGroupPaneNoPop.getInstance(hyperlinkGroupPaneActionProvider);
}
public void setAuthorityMode(boolean isUpMode) { public void setAuthorityMode(boolean isUpMode) {
centerPane.setAuthorityMode(isUpMode); centerPane.setAuthorityMode(isUpMode);
} }

5
designer/src/com/fr/design/mainframe/ReportComponent.java

@ -44,6 +44,11 @@ public abstract class ReportComponent<T extends TemplateReport, E extends Elemen
public abstract S getDefaultSelectElement(); public abstract S getDefaultSelectElement();
/**
* 更新JSliderPane
*/
public abstract void updateJSliderValue();
@Override @Override
public ShortCut[] shortcut4TemplateMenu() { public ShortCut[] shortcut4TemplateMenu() {

51
designer/src/com/fr/design/mainframe/ReportComponentComposite.java

@ -2,6 +2,7 @@ package com.fr.design.mainframe;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.base.ScreenResolution; import com.fr.base.ScreenResolution;
import com.fr.common.inputevent.InputEventBaseOnOS;
import com.fr.design.designer.EditingState; import com.fr.design.designer.EditingState;
import com.fr.design.event.TargetModifiedListener; import com.fr.design.event.TargetModifiedListener;
import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.HistoryTemplateListPane;
@ -11,6 +12,7 @@ import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.grid.Grid; import com.fr.grid.Grid;
import com.fr.main.impl.WorkBook; import com.fr.main.impl.WorkBook;
import com.fr.poly.PolyDesigner;
import com.fr.report.report.TemplateReport; import com.fr.report.report.TemplateReport;
import javax.swing.*; import javax.swing.*;
@ -31,6 +33,7 @@ public class ReportComponentComposite extends JComponent {
private static final int MAX = 400; private static final int MAX = 400;
private static final int HUND = 100; private static final int HUND = 100;
private static final int MIN = 10; private static final int MIN = 10;
private static final int DIR = 15;
private JWorkBook parent; private JWorkBook parent;
private UIModeControlContainer parentContainer = null; private UIModeControlContainer parentContainer = null;
@ -45,9 +48,6 @@ public class ReportComponentComposite extends JComponent {
private JSliderPane jSliderContainer; private JSliderPane jSliderContainer;
private boolean isCtrl = false;
/** /**
* Constructor with workbook.. * Constructor with workbook..
*/ */
@ -66,32 +66,13 @@ public class ReportComponentComposite extends JComponent {
jSliderContainer.getSelfAdaptButton().addItemListener(selfAdaptButtonItemListener); jSliderContainer.getSelfAdaptButton().addItemListener(selfAdaptButtonItemListener);
} }
KeyListener showValSpinnerKeyListener = new KeyListener() {
@Override
public void keyTyped(KeyEvent e) {
}
@Override
public void keyPressed(KeyEvent e) {
if (e.isControlDown()) {
isCtrl = true;
}
}
@Override
public void keyReleased(KeyEvent e) {
isCtrl = false;
}
};
MouseWheelListener showValSpinnerMouseWheelListener = new MouseWheelListener() { MouseWheelListener showValSpinnerMouseWheelListener = new MouseWheelListener() {
@Override @Override
public void mouseWheelMoved(MouseWheelEvent e) { public void mouseWheelMoved(MouseWheelEvent e) {
if (isCtrl) { if (InputEventBaseOnOS.isControlDown(e)) {
int dir = e.getWheelRotation(); int dir = e.getWheelRotation();
int old_resolution = (int) jSliderContainer.getShowVal().getValue(); int old_resolution = (int) jSliderContainer.getShowVal().getValue();
jSliderContainer.getShowVal().setValue(old_resolution - (dir * MIN)); jSliderContainer.getShowVal().setValue(old_resolution - (dir * DIR));
} }
} }
}; };
@ -131,7 +112,6 @@ public class ReportComponentComposite extends JComponent {
return; return;
} }
centerCardPane.populate(workbook.getTemplateReport(newIndex)); centerCardPane.populate(workbook.getTemplateReport(newIndex));
if (parentContainer != null) { if (parentContainer != null) {
parentContainer.setDownPane(ReportComponentComposite.this); parentContainer.setDownPane(ReportComponentComposite.this);
} }
@ -140,27 +120,35 @@ public class ReportComponentComposite extends JComponent {
EditingState reportPaneEditState = templateStateList.get(newIndex); EditingState reportPaneEditState = templateStateList.get(newIndex);
if (reportPaneEditState != null) { if (reportPaneEditState != null) {
reportPaneEditState.revert(); reportPaneEditState.revert();
updateJSlider();
} }
} else { } else {
while (templateStateList.size() <= newIndex) { while (templateStateList.size() <= newIndex) {
templateStateList.add(null); templateStateList.add(null);
} }
centerCardPane.editingComponet.setSelection(centerCardPane.editingComponet.getDefaultSelectElement()); centerCardPane.editingComponet.setSelection(centerCardPane.editingComponet.getDefaultSelectElement());
if (jSliderContainer != null){
jSliderContainer.reset();
}
} }
if (centerCardPane.editingComponet.elementCasePane == null) { if (centerCardPane.editingComponet.elementCasePane == null) {
centerCardPane.getPolyDezi().polyArea.addMouseWheelListener(showValSpinnerMouseWheelListener);
return; return;
} }
Grid grid = centerCardPane.editingComponet.elementCasePane.getGrid(); Grid grid = centerCardPane.editingComponet.elementCasePane.getGrid();
this.centerCardPane.editingComponet.elementCasePane.getGrid().addMouseWheelListener(showValSpinnerMouseWheelListener); this.centerCardPane.editingComponet.elementCasePane.getGrid().addMouseWheelListener(showValSpinnerMouseWheelListener);
this.centerCardPane.editingComponet.elementCasePane.getGrid().addKeyListener(showValSpinnerKeyListener);
if (!grid.hasFocus() && grid.isRequestFocusEnabled()) { if (!grid.hasFocus() && grid.isRequestFocusEnabled()) {
grid.requestFocus(); grid.requestFocus();
} }
} }
private void updateJSlider(){
centerCardPane.editingComponet.updateJSliderValue();
}
/** /**
* 移除选中状态 * 移除选中状态
* *
@ -224,19 +212,14 @@ public class ReportComponentComposite extends JComponent {
} }
private JComponent createSouthControlPane() { private JComponent createSouthControlPane() {
// hbarContainer = FRGUIPaneFactory.createBorderLayout_S_Pane();
// hbarContainer.add(createSouthControlPaneWithJSliderPane());
hbarContainer = FRGUIPaneFactory.createBorderLayout_S_Pane(); hbarContainer = FRGUIPaneFactory.createBorderLayout_S_Pane();
hbarContainer.add(centerCardPane.editingComponet.getHorizontalScrollBar()); hbarContainer.add(centerCardPane.editingComponet.getHorizontalScrollBar());
// JSplitPane splitpane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, sheetNameTab, hbarContainer);
JPanel southPane = new JPanel(new BorderLayout()); JPanel southPane = new JPanel(new BorderLayout());
jSliderContainer = JSliderPane.getInstance(); jSliderContainer = JSliderPane.getInstance();
JSplitPane splitpane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, sheetNameTab, jSliderContainer);
splitpane.setBorder(null);
splitpane.setDividerSize(3);
splitpane.setResizeWeight(1);
southPane.add(hbarContainer, BorderLayout.NORTH); southPane.add(hbarContainer, BorderLayout.NORTH);
southPane.add(splitpane, BorderLayout.CENTER); southPane.add(sheetNameTab, BorderLayout.CENTER);
southPane.add(jSliderContainer, BorderLayout.EAST);
return southPane; return southPane;
} }

26
designer/src/com/fr/design/mainframe/ReportFloatPane.java

@ -23,7 +23,6 @@ import java.awt.*;
public class ReportFloatPane extends JPanel { public class ReportFloatPane extends JPanel {
private static ReportFloatPane THIS; private static ReportFloatPane THIS;
private ElementCasePaneDelegate elementCasePaneDelegate;
private MenuDef insertFloatMenu; private MenuDef insertFloatMenu;
private ReportFloatPane() { private ReportFloatPane() {
@ -37,12 +36,20 @@ public class ReportFloatPane extends JPanel {
return THIS; return THIS;
} }
public void refreshInsertFloatMenu(ElementCasePaneDelegate elementCasePaneDelegate) {
insertFloatMenu.clearShortCuts();
UpdateAction[] actions = ActionFactory.createFloatInsertAction(ElementCasePane.class, elementCasePaneDelegate);
for (int i = 0; i < actions.length; i++) {
insertFloatMenu.addShortCut(actions[i]);
}
}
private void initComponent() { private void initComponent() {
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout());
UIToolbar topToolBar = new UIToolbar(); UIToolbar topToolBar = new UIToolbar();
topToolBar.setLayout(new BorderLayout()); topToolBar.setLayout(new BorderLayout());
insertFloatMenu = createInsertToolBar(); initInsertToolBar();
topToolBar.setPreferredSize(new Dimension(155,20)); topToolBar.setPreferredSize(new Dimension(155,20));
topToolBar.add(createButtonUI(), BorderLayout.CENTER); topToolBar.add(createButtonUI(), BorderLayout.CENTER);
topToolBar.setBorder(BorderFactory.createEmptyBorder(-1, -1, -1, -1)); topToolBar.setBorder(BorderFactory.createEmptyBorder(-1, -1, -1, -1));
@ -62,23 +69,24 @@ public class ReportFloatPane extends JPanel {
new Component[]{new UILabel(), new UILabel(Inter.getLocText("FR-Designer_Add_FloatElement")), emptyLabel, toolBarPane}, new Component[]{new UILabel(), new UILabel(Inter.getLocText("FR-Designer_Add_FloatElement")), emptyLabel, toolBarPane},
}; };
JPanel leftTopPane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); JPanel leftTopPane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
leftTopPane.setBorder(BorderFactory.createEmptyBorder(10, 5, 0, 15)); leftTopPane.setBorder(BorderFactory.createEmptyBorder(12, 5, 0, 15));
this.add(leftTopPane, BorderLayout.NORTH); this.add(leftTopPane, BorderLayout.NORTH);
} }
private MenuDef createInsertToolBar() { private void initInsertToolBar() {
MenuDef insertFloatMenu = new MenuDef(); insertFloatMenu = new MenuDef(true);
insertFloatMenu.setName(KeySetUtils.INSERT_FLOAT.getMenuKeySetName()); insertFloatMenu.setName(KeySetUtils.INSERT_FLOAT.getMenuKeySetName());
insertFloatMenu.setTooltip(Inter.getLocText("FR-Designer_T_Insert_Float")); insertFloatMenu.setTooltip(Inter.getLocText("FR-Designer_T_Insert_Float"));
insertFloatMenu.setIconPath("com/fr/design/images/control/addPopup.png"); insertFloatMenu.setIconPath("com/fr/design/images/control/addPopup.png");
JTemplate editingTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); JTemplate editingTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
elementCasePaneDelegate = (ElementCasePaneDelegate) editingTemplate.getCurrentElementCasePane(); JComponent currentElementCasePane = editingTemplate.getCurrentElementCasePane();
UpdateAction[] actions = ActionFactory.createFloatInsertAction(ElementCasePane.class, elementCasePaneDelegate); if (currentElementCasePane != null) {
insertFloatMenu.clearShortCuts();
UpdateAction[] actions = ActionFactory.createFloatInsertAction(ElementCasePane.class, currentElementCasePane);
for (int i = 0; i < actions.length; i++) { for (int i = 0; i < actions.length; i++) {
insertFloatMenu.addShortCut(actions[i]); insertFloatMenu.addShortCut(actions[i]);
} }
return insertFloatMenu; }
} }
private UIButton createButtonUI() { private UIButton createButtonUI() {

5
designer/src/com/fr/design/mainframe/ReportHyperlinkGroupPane.java

@ -23,7 +23,8 @@ import java.awt.*;
public class ReportHyperlinkGroupPane extends HyperlinkGroupPane { public class ReportHyperlinkGroupPane extends HyperlinkGroupPane {
private static ReportHyperlinkGroupPane singleton; private static ReportHyperlinkGroupPane singleton;
private ReportHyperlinkGroupPane(HyperlinkGroupPaneActionProvider hyperlinkGroupPaneActionProvider) { // 仅供继承使用,外部通过 getInstance 获取实例
protected ReportHyperlinkGroupPane(HyperlinkGroupPaneActionProvider hyperlinkGroupPaneActionProvider) {
super(hyperlinkGroupPaneActionProvider); super(hyperlinkGroupPaneActionProvider);
} }
@ -35,7 +36,7 @@ public class ReportHyperlinkGroupPane extends HyperlinkGroupPane {
return singleton; return singleton;
} }
private void refreshPane() { protected void refreshPane() {
ElementCasePane reportPane = ((JWorkBook)HistoryTemplateListPane.getInstance().getCurrentEditingTemplate()).getEditingElementCasePane(); ElementCasePane reportPane = ((JWorkBook)HistoryTemplateListPane.getInstance().getCurrentEditingTemplate()).getEditingElementCasePane();
if (reportPane == null) { if (reportPane == null) {
return; return;

27
designer/src/com/fr/design/mainframe/ReportHyperlinkGroupPaneNoPop.java

@ -0,0 +1,27 @@
package com.fr.design.mainframe;
import com.fr.design.gui.frpane.HyperlinkGroupPaneActionProvider;
/**
* Created by plough on 2017/9/4.
*/
public class ReportHyperlinkGroupPaneNoPop extends ReportHyperlinkGroupPane{
private static ReportHyperlinkGroupPaneNoPop singleton;
private ReportHyperlinkGroupPaneNoPop(HyperlinkGroupPaneActionProvider hyperlinkGroupPaneActionProvider) {
super(hyperlinkGroupPaneActionProvider);
}
public static ReportHyperlinkGroupPaneNoPop getInstance(HyperlinkGroupPaneActionProvider hyperlinkGroupPaneActionProvider) {
if (singleton == null) {
singleton = new ReportHyperlinkGroupPaneNoPop(hyperlinkGroupPaneActionProvider);
}
singleton.refreshPane();
return singleton;
}
@Override
protected boolean isNewStyle() {
return false;
}
}

44
designer/src/com/fr/design/mainframe/SheetNameTabPane.java

@ -25,11 +25,13 @@ import com.fr.design.actions.UpdateAction;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ibutton.UIButtonUI;
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.design.roleAuthority.ReportAndFSManagePane; import com.fr.design.roleAuthority.ReportAndFSManagePane;
import com.fr.design.roleAuthority.RolesAlreadyEditedPane; import com.fr.design.roleAuthority.RolesAlreadyEditedPane;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.design.utils.gui.GUIPaintUtils;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.main.impl.WorkBook; import com.fr.main.impl.WorkBook;
@ -54,10 +56,10 @@ public class SheetNameTabPane extends JComponent implements MouseListener, Mouse
private static final Icon WORK_SHEET_ICON = BaseUtils.readIcon("com/fr/base/images/oem/worksheet.png"); private static final Icon WORK_SHEET_ICON = BaseUtils.readIcon("com/fr/base/images/oem/worksheet.png");
private static final Icon POLY_SHEET_ICON = BaseUtils.readIcon("com/fr/design/images/sheet/polysheet.png"); private static final Icon POLY_SHEET_ICON = BaseUtils.readIcon("com/fr/design/images/sheet/polysheet.png");
private static final Image DESIGN_IMAGE = BaseUtils.readImage("com/fr/design/images/sheet/left_right_btn.png"); private static final Image DESIGN_IMAGE = BaseUtils.readImage("com/fr/design/images/sheet/left_right_btn.png");
private static final Icon LEFT_ICON = BaseUtils.createIcon(DESIGN_IMAGE, 0, 0, 14, 14); private static final Icon LEFT_ICON = BaseUtils.readIcon("com/fr/design/images/sheet/left_normal@1x.png");
private static final Icon RIGHT_ICON = BaseUtils.createIcon(DESIGN_IMAGE, 14, 0, 14, 14); private static final Icon RIGHT_ICON = BaseUtils.readIcon("com/fr/design/images/sheet/right_normal@1x.png");
private static final Icon DISABLED_LEFT_ICON = BaseUtils.createIcon(DESIGN_IMAGE, 0, 14, 14, 14); private static final Icon DISABLED_LEFT_ICON = BaseUtils.readIcon("com/fr/design/images/sheet/left_hover@1x.png");
private static final Icon DISABLED_RIGHT_ICON = BaseUtils.createIcon(DESIGN_IMAGE, 14, 14, 14, 14); private static final Icon DISABLED_RIGHT_ICON = BaseUtils.readIcon("com/fr/design/images/sheet/right_hover@1x.png");
private static final int ICON_SEP_DISTANCE = 8; private static final int ICON_SEP_DISTANCE = 8;
private static final int TOOLBAR_HEIGHT = 16; private static final int TOOLBAR_HEIGHT = 16;
@ -145,6 +147,18 @@ public class SheetNameTabPane extends JComponent implements MouseListener, Mouse
return new Dimension(super.getPreferredSize().width, TOOLBAR_HEIGHT); return new Dimension(super.getPreferredSize().width, TOOLBAR_HEIGHT);
} }
}; };
leftButton.setUI(new UIButtonUI() {
@Override
protected void doExtraPainting(UIButton b, Graphics2D g2d, int w, int h, String selectedRoles) {
if (isPressed(b) && b.isPressedPainted()) {
GUIPaintUtils.fillPressed(g2d, 0, 0, w, h, b.isRoundBorder(), b.getRectDirection(), b.isDoneAuthorityEdited(selectedRoles), UIConstants.PROPERTY_PANE_BACKGROUND);
} else if (isRollOver(b)) {
GUIPaintUtils.fillRollOver(g2d, 0, 0, w, h, b.isRoundBorder(), b.getRectDirection(), b.isDoneAuthorityEdited(selectedRoles), b.isPressedPainted(), UIConstants.PROPERTY_PANE_BACKGROUND);
} else if (b.isNormalPainted()) {
GUIPaintUtils.fillNormal(g2d, 0, 0, w, h, b.isRoundBorder(), b.getRectDirection(), b.isDoneAuthorityEdited(selectedRoles), b.isPressedPainted());
}
}
});
leftButton.set4ToolbarButton(); leftButton.set4ToolbarButton();
leftButton.setDisabledIcon(DISABLED_LEFT_ICON); leftButton.setDisabledIcon(DISABLED_LEFT_ICON);
rightButton = new UIButton(RIGHT_ICON) { rightButton = new UIButton(RIGHT_ICON) {
@ -152,6 +166,18 @@ public class SheetNameTabPane extends JComponent implements MouseListener, Mouse
return new Dimension(super.getPreferredSize().width, TOOLBAR_HEIGHT); return new Dimension(super.getPreferredSize().width, TOOLBAR_HEIGHT);
} }
}; };
rightButton.setUI(new UIButtonUI() {
@Override
protected void doExtraPainting(UIButton b, Graphics2D g2d, int w, int h, String selectedRoles) {
if (isPressed(b) && b.isPressedPainted()) {
GUIPaintUtils.fillPressed(g2d, 0, 0, w, h, b.isRoundBorder(), b.getRectDirection(), b.isDoneAuthorityEdited(selectedRoles), UIConstants.PROPERTY_PANE_BACKGROUND);
} else if (isRollOver(b)) {
GUIPaintUtils.fillRollOver(g2d, 0, 0, w, h, b.isRoundBorder(), b.getRectDirection(), b.isDoneAuthorityEdited(selectedRoles), b.isPressedPainted(), UIConstants.PROPERTY_PANE_BACKGROUND);
} else if (b.isNormalPainted()) {
GUIPaintUtils.fillNormal(g2d, 0, 0, w, h, b.isRoundBorder(), b.getRectDirection(), b.isDoneAuthorityEdited(selectedRoles), b.isPressedPainted());
}
}
});
rightButton.set4ToolbarButton(); rightButton.set4ToolbarButton();
rightButton.setDisabledIcon(DISABLED_RIGHT_ICON); rightButton.setDisabledIcon(DISABLED_RIGHT_ICON);
buttonPane = new JPanel(new BorderLayout(3, 0)); buttonPane = new JPanel(new BorderLayout(3, 0));
@ -407,7 +433,7 @@ public class SheetNameTabPane extends JComponent implements MouseListener, Mouse
sheeticon.paintIcon(this, g2d, (int) textX + charWidth, 2); sheeticon.paintIcon(this, g2d, (int) textX + charWidth, 2);
// peter:画字符 // peter:画字符
g2d.setPaint(getForeground()); g2d.setPaint(getForeground());
g2d.drawString(sheetName, (int) textX + charWidth + 14, textAscent); GraphHelper.drawString(g2d, sheetName, (int) textX + charWidth + 14, textAscent);
} }
/** /**
@ -423,7 +449,7 @@ public class SheetNameTabPane extends JComponent implements MouseListener, Mouse
* @param i * @param i
*/ */
private void paintUnSelectedTab(Graphics2D g2d, Icon sheetIcon, double textHeight, double textX, String sheetName, int charWidth, int textAscent, int i, boolean isNeedPaintAuthority) { private void paintUnSelectedTab(Graphics2D g2d, Icon sheetIcon, double textHeight, double textX, String sheetName, int charWidth, int textAscent, int i, boolean isNeedPaintAuthority) {
Color tabBackground = UIConstants.SHEET_NORMAL; Color tabBackground = UIConstants.COMBOBOX_BTN_NORMAL;
int width = widthArray[i]; int width = widthArray[i];
double[] x = {textX, textX, textX + LEFT_CORNOR, textX + width - RIGHT_CORNOR, textX + width, textX + width}; double[] x = {textX, textX, textX + LEFT_CORNOR, textX + width - RIGHT_CORNOR, textX + width, textX + width};
double[] y = {0, textHeight - LEFT_CORNOR, textHeight, textHeight, textHeight - RIGHT_CORNOR, 0}; double[] y = {0, textHeight - LEFT_CORNOR, textHeight, textHeight, textHeight - RIGHT_CORNOR, 0};
@ -554,10 +580,12 @@ public class SheetNameTabPane extends JComponent implements MouseListener, Mouse
for (int i = scrollIndex; i <= lastOneIndex; i++) { for (int i = scrollIndex; i <= lastOneIndex; i++) {
int textWidth = widthArray[i]; int textWidth = widthArray[i];
if (evtX >= textX && evtX < textX + textWidth) { if (evtX >= textX && evtX < textX + textWidth) {
if (getSelectedIndex() != i) { boolean needRefreshPropertiesPane = getSelectedIndex() != i;
setSelectedIndex(i);
if (needRefreshPropertiesPane) {
HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().refreshEastPropertiesPane(); HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().refreshEastPropertiesPane();
} }
setSelectedIndex(i);
isBlank = false; isBlank = false;
reportComposite.setComposite(); reportComposite.setComposite();
if (isAuthorityEditing) { if (isAuthorityEditing) {

11
designer/src/com/fr/design/mainframe/WorkSheetDesigner.java

@ -4,11 +4,13 @@ import java.awt.BorderLayout;
import javax.swing.*; import javax.swing.*;
import com.fr.base.ScreenResolution;
import com.fr.design.DesignState; import com.fr.design.DesignState;
import com.fr.design.actions.report.*; import com.fr.design.actions.report.*;
import com.fr.design.designer.EditingState; import com.fr.design.designer.EditingState;
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.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.menu.*; import com.fr.design.menu.*;
import com.fr.grid.selection.CellSelection; import com.fr.grid.selection.CellSelection;
@ -21,6 +23,8 @@ import com.fr.stable.ArrayUtils;
public class WorkSheetDesigner extends ReportComponent<WorkSheet, ElementCasePaneDelegate, Selection> { public class WorkSheetDesigner extends ReportComponent<WorkSheet, ElementCasePaneDelegate, Selection> {
private static final int HUND = 100;
public WorkSheetDesigner(WorkSheet sheet) { public WorkSheetDesigner(WorkSheet sheet) {
super(sheet); super(sheet);
@ -166,6 +170,13 @@ public class WorkSheetDesigner extends ReportComponent<WorkSheet, ElementCasePan
return cellElement == null ? new CellSelection() : new CellSelection(0, 0, cellElement.getColumnSpan(), cellElement.getRowSpan()); return cellElement == null ? new CellSelection() : new CellSelection(0, 0, cellElement.getColumnSpan(), cellElement.getRowSpan());
} }
@Override
public void updateJSliderValue() {
ReportComponentComposite reportComposite = (ReportComponentComposite) HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getCurrentReportComponentPane();
JSliderPane jSliderContainer = reportComposite.getjSliderContainer();
jSliderContainer.getShowVal().setValue((int)Math.ceil((double) this.elementCasePane.getResolution() * HUND / ScreenResolution.getScreenResolution()));
}
@Override @Override
public void addSelectionChangeListener(SelectionListener selectionListener) { public void addSelectionChangeListener(SelectionListener selectionListener) {
elementCasePane.addSelectionChangeListener(selectionListener); elementCasePane.addSelectionChangeListener(selectionListener);

17
designer/src/com/fr/design/mainframe/alphafine/AlphaFineConstants.java

@ -66,24 +66,25 @@ public class AlphaFineConstants {
public static final Font GREATER_FONT = new Font("Song_TypeFace", 0, 20); public static final Font GREATER_FONT = new Font("Song_TypeFace", 0, 20);
public static final String IMAGE_URL = "/com/fr/design/mainframe/alphafine/images/";
public static final String PLUGIN_SEARCH_URL = SiteCenter.getInstance().acquireUrlByKind("plugin.searchAPI"); public static final String PLUGIN_SEARCH_URL = SiteCenter.getInstance().acquireUrlByKind("plugin.searchAPI");
public static final String PLUGIN_URL = "http://shop.finereport.com/plugin/"; public static final String PLUGIN_URL = SiteCenter.getInstance().acquireUrlByKind("af.plugin");
public static final String REUSE_URL = "http://shop.finereport.com/reuse/"; public static final String REUSE_URL = SiteCenter.getInstance().acquireUrlByKind("af.reuse");
public static final String DOCUMENT_DOC_URL = "http://help.finereport.com/doc-view-"; public static final String DOCUMENT_DOC_URL = SiteCenter.getInstance().acquireUrlByKind("af.doc_view");
public static final String DOCUMENT_SEARCH_URL = "http://help.finereport.com/?api-search-title-"; public static final String DOCUMENT_SEARCH_URL = SiteCenter.getInstance().acquireUrlByKind("af.doc_search");
public static final String DOCUMENT_INFORMATION_URL = "http://help.finereport.com/?api-search-did-"; public static final String DOCUMENT_INFORMATION_URL = SiteCenter.getInstance().acquireUrlByKind("af.doc_info");
public static final String PLUGIN_IMAGE_URL = "http://shopres.finereport.com/"; public static final String PLUGIN_IMAGE_URL = SiteCenter.getInstance().acquireUrlByKind("af.plugin_image");
public static final String CLOUD_SERVER_URL = "http://cloud.fanruan.com/api/monitor/record_of_afsearch/single"; public static final String CLOUD_SERVER_URL = SiteCenter.getInstance().acquireUrlByKind("af.record");
public static final String SEARCH_API = "http://cloud.fanruan.com/api/intelligence/search/recommend?searchKey="; public static final String SEARCH_API = SiteCenter.getInstance().acquireUrlByKind("af.cloud_search");
} }

4
designer/src/com/fr/design/mainframe/alphafine/AlphaFineHelper.java

@ -19,7 +19,6 @@ import java.util.List;
* Created by XiaXiang on 2017/5/8. * Created by XiaXiang on 2017/5/8.
*/ */
public class AlphaFineHelper { public class AlphaFineHelper {
public static final NoResultModel NO_RESULT_MODEL = new NoResultModel(Inter.getLocText("FR-Designer_AlphaFine_NoResult"));
public static final NoResultModel NO_CONNECTION_MODEL = new NoResultModel(Inter.getLocText("FR-Designer_ConnectionFailed")); public static final NoResultModel NO_CONNECTION_MODEL = new NoResultModel(Inter.getLocText("FR-Designer_ConnectionFailed"));
private static AlphaFineDialog alphaFineDialog; private static AlphaFineDialog alphaFineDialog;
@ -27,6 +26,9 @@ public class AlphaFineHelper {
* 弹出alphafine搜索面板 * 弹出alphafine搜索面板
*/ */
public static void showAlphaFineDialog(boolean forceOpen) { public static void showAlphaFineDialog(boolean forceOpen) {
if (!AlphaFineConfigManager.isALPHALicAvailable()) {
return;
}
if (alphaFineDialog == null) { if (alphaFineDialog == null) {
alphaFineDialog = new AlphaFineDialog(DesignerContext.getDesignerFrame(), forceOpen); alphaFineDialog = new AlphaFineDialog(DesignerContext.getDesignerFrame(), forceOpen);
alphaFineDialog.setVisible(true); alphaFineDialog.setVisible(true);

13
designer/src/com/fr/design/mainframe/alphafine/cell/model/ActionModel.java

@ -1,25 +1,24 @@
package com.fr.design.mainframe.alphafine.cell.model; package com.fr.design.mainframe.alphafine.cell.model;
import com.fr.design.actions.UpdateAction;
import com.fr.design.mainframe.alphafine.CellType; import com.fr.design.mainframe.alphafine.CellType;
import com.fr.general.FRLogger; import com.fr.general.FRLogger;
import com.fr.json.JSONException; import com.fr.json.JSONException;
import com.fr.json.JSONObject; import com.fr.json.JSONObject;
import javax.swing.*;
/** /**
* Created by XiaXiang on 2017/4/20. * Created by XiaXiang on 2017/4/20.
*/ */
public class ActionModel extends AlphaCellModel { public class ActionModel extends AlphaCellModel {
private Action action; private UpdateAction action;
public ActionModel(String name, String description, Action action, int searchCount) { public ActionModel(String name, String description, UpdateAction action, int searchCount) {
this(name, description, action); this(name, description, action);
setSearchCount(searchCount); setSearchCount(searchCount);
} }
public ActionModel(String name, String description, Action action) { public ActionModel(String name, String description, UpdateAction action) {
super(name, null, CellType.ACTION); super(name, null, CellType.ACTION);
this.action = action; this.action = action;
this.setDescription(description); this.setDescription(description);
@ -43,11 +42,11 @@ public class ActionModel extends AlphaCellModel {
return action != null ? action.hashCode() : 0; return action != null ? action.hashCode() : 0;
} }
public Action getAction() { public UpdateAction getAction() {
return action; return action;
} }
public void setAction(Action action) { public void setAction(UpdateAction action) {
this.action = action; this.action = action;
} }

1
designer/src/com/fr/design/mainframe/alphafine/cell/model/AlphaCellModel.java

@ -68,6 +68,7 @@ public abstract class AlphaCellModel implements Comparable {
public boolean isNeedToSendToServer() { public boolean isNeedToSendToServer() {
return true; return true;
} }
/** /**
* model转json * model转json
* *

13
designer/src/com/fr/design/mainframe/alphafine/cell/render/ContentCellRender.java

@ -1,10 +1,10 @@
package com.fr.design.mainframe.alphafine.cell.render; package com.fr.design.mainframe.alphafine.cell.render;
import com.bulenkov.iconloader.IconLoader;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.mainframe.alphafine.AlphaFineConstants; import com.fr.design.mainframe.alphafine.AlphaFineConstants;
import com.fr.design.mainframe.alphafine.cell.model.AlphaCellModel; import com.fr.design.mainframe.alphafine.cell.model.AlphaCellModel;
import com.fr.design.mainframe.alphafine.cell.model.MoreModel; import com.fr.design.mainframe.alphafine.cell.model.MoreModel;
import com.fr.general.IOUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.*; import javax.swing.*;
@ -15,6 +15,9 @@ import java.awt.*;
*/ */
public class ContentCellRender implements ListCellRenderer<Object> { public class ContentCellRender implements ListCellRenderer<Object> {
private static final int OFFSET = 45; private static final int OFFSET = 45;
private static final String SELECTED_PATH = AlphaFineConstants.IMAGE_URL + "selected";
private static final String CELL_PATH = AlphaFineConstants.IMAGE_URL + "alphafine";
private static final String SUFFIX = ".png";
@Override @Override
public Component getListCellRendererComponent(JList<?> list, Object value, int index, boolean isSelected, boolean cellHasFocus) { public Component getListCellRendererComponent(JList<?> list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
@ -30,13 +33,13 @@ public class ContentCellRender implements ListCellRenderer<Object> {
titleLabel.setText(" " + model.getName()); titleLabel.setText(" " + model.getName());
if (model.hasAction()) { if (model.hasAction()) {
if (isSelected) { if (isSelected) {
String iconUrl = "/com/fr/design/mainframe/alphafine/images/selected" + model.getType().getTypeValue() + ".png"; String iconUrl = SELECTED_PATH + model.getType().getTypeValue() + SUFFIX;
panel.setBackground(AlphaFineConstants.BLUE); panel.setBackground(AlphaFineConstants.BLUE);
titleLabel.setForeground(Color.WHITE); titleLabel.setForeground(Color.WHITE);
titleLabel.setIcon(new ImageIcon(IOUtils.readImage(iconUrl))); titleLabel.setIcon(IconLoader.getIcon(iconUrl));
} else { } else {
String iconUrl = "/com/fr/design/mainframe/alphafine/images/alphafine" + model.getType().getTypeValue() + ".png"; String iconUrl = CELL_PATH + model.getType().getTypeValue() + SUFFIX;
titleLabel.setIcon(new ImageIcon(IOUtils.readImage(iconUrl))); titleLabel.setIcon(IconLoader.getIcon(iconUrl));
titleLabel.setForeground(AlphaFineConstants.BLACK); titleLabel.setForeground(AlphaFineConstants.BLACK);
} }

9
designer/src/com/fr/design/mainframe/alphafine/cell/render/TitleCellRender.java

@ -3,7 +3,6 @@ package com.fr.design.mainframe.alphafine.cell.render;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.mainframe.alphafine.AlphaFineConstants; import com.fr.design.mainframe.alphafine.AlphaFineConstants;
import com.fr.design.mainframe.alphafine.cell.model.MoreModel; import com.fr.design.mainframe.alphafine.cell.model.MoreModel;
import com.fr.general.IOUtils;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;
@ -33,14 +32,6 @@ public class TitleCellRender implements ListCellRenderer<Object> {
showMoreLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 10)); showMoreLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 10));
panel.add(showMoreLabel, BorderLayout.EAST); panel.add(showMoreLabel, BorderLayout.EAST);
} }
if (moreModel.isLoading()) {
ImageIcon imageIcon = new ImageIcon(getClass().getResource("/com/fr/design/mainframe/alphafine/images/loading.gif"));
//设置cell的加载动画
imageIcon.setImageObserver(list);
UILabel loadingLabel = new UILabel(imageIcon);
loadingLabel.setBorder(BorderFactory.createEmptyBorder(LOAD_OFFSET,0,0,0));
panel.add(loadingLabel, 0);
}
panel.setPreferredSize(new Dimension(list.getFixedCellWidth(), AlphaFineConstants.CELL_TITLE_HEIGHT)); panel.setPreferredSize(new Dimension(list.getFixedCellWidth(), AlphaFineConstants.CELL_TITLE_HEIGHT));
return panel; return panel;
} }

345
designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java

@ -1,7 +1,10 @@
package com.fr.design.mainframe.alphafine.component; package com.fr.design.mainframe.alphafine.component;
import com.bulenkov.iconloader.IconLoader;
import com.fr.base.ConfigManager;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.actions.help.alphafine.AlphaFineConfigManager;
import com.fr.design.dialog.UIDialog; import com.fr.design.dialog.UIDialog;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.icontainer.UIScrollPane;
@ -16,11 +19,16 @@ import com.fr.design.mainframe.alphafine.cell.model.PluginModel;
import com.fr.design.mainframe.alphafine.cell.render.ContentCellRender; import com.fr.design.mainframe.alphafine.cell.render.ContentCellRender;
import com.fr.design.mainframe.alphafine.listener.DocumentAdapter; import com.fr.design.mainframe.alphafine.listener.DocumentAdapter;
import com.fr.design.mainframe.alphafine.model.SearchResult; import com.fr.design.mainframe.alphafine.model.SearchResult;
import com.fr.design.mainframe.alphafine.preview.ActionPreviewPane;
import com.fr.design.mainframe.alphafine.preview.DocumentPreviewPane; import com.fr.design.mainframe.alphafine.preview.DocumentPreviewPane;
import com.fr.design.mainframe.alphafine.preview.FilePreviewPane; import com.fr.design.mainframe.alphafine.preview.FilePreviewPane;
import com.fr.design.mainframe.alphafine.preview.NoResultPane;
import com.fr.design.mainframe.alphafine.preview.PluginPreviewPane; import com.fr.design.mainframe.alphafine.preview.PluginPreviewPane;
import com.fr.design.mainframe.alphafine.search.manager.*; import com.fr.design.mainframe.alphafine.search.manager.ActionSearchManager;
import com.fr.design.mainframe.alphafine.search.manager.DocumentSearchManager;
import com.fr.design.mainframe.alphafine.search.manager.FileSearchManager;
import com.fr.design.mainframe.alphafine.search.manager.PluginSearchManager;
import com.fr.design.mainframe.alphafine.search.manager.RecentSearchManager;
import com.fr.design.mainframe.alphafine.search.manager.RecommendSearchManager;
import com.fr.form.main.Form; import com.fr.form.main.Form;
import com.fr.form.main.FormIO; import com.fr.form.main.FormIO;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
@ -42,7 +50,13 @@ import javax.swing.event.DocumentEvent;
import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener; import javax.swing.event.ListSelectionListener;
import java.awt.*; import java.awt.*;
import java.awt.event.*; import java.awt.event.AWTEventListener;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.io.IOException; import java.io.IOException;
import java.net.URL; import java.net.URL;
@ -69,12 +83,16 @@ public class AlphaFineDialog extends UIDialog {
private static final String PLUGIN_MARK_SHORT = "k:4 "; private static final String PLUGIN_MARK_SHORT = "k:4 ";
private static final String PLUGIN_MARK = "k:shop "; private static final String PLUGIN_MARK = "k:shop ";
private static final String PLACE_HOLDER = Inter.getLocText("FR-Designer_AlphaFine"); private static final String PLACE_HOLDER = Inter.getLocText("FR-Designer_AlphaFine");
private static final int MAX_SHOW_SIZE = 12;
private AlphaFineTextField searchTextField; private AlphaFineTextField searchTextField;
private UIButton closeButton; private UIButton closeButton;
private JPanel searchResultPane; private JPanel searchResultPane;
private Point pressedPoint;
private UIScrollPane leftSearchResultPane; private UIScrollPane leftSearchResultPane;
private JPanel defaultPane;
//分割线
private UILabel splitLabel;
private JPanel rightSearchResultPane; private JPanel rightSearchResultPane;
private AlphaFineList searchResultList; private AlphaFineList searchResultList;
private SearchListModel searchListModel; private SearchListModel searchListModel;
@ -84,7 +102,6 @@ public class AlphaFineDialog extends UIDialog {
//是否强制打开,因为面板是否关闭绑定了全局鼠标事件,这里需要处理一下 //是否强制打开,因为面板是否关闭绑定了全局鼠标事件,这里需要处理一下
private boolean forceOpen; private boolean forceOpen;
public AlphaFineDialog(Frame parent, boolean forceOpen) { public AlphaFineDialog(Frame parent, boolean forceOpen) {
super(parent); super(parent);
this.forceOpen = forceOpen; this.forceOpen = forceOpen;
@ -107,7 +124,7 @@ public class AlphaFineDialog extends UIDialog {
KeyEvent e = (KeyEvent) event; KeyEvent e = (KeyEvent) event;
KeyStroke keyStroke = (KeyStroke) KeyStroke.getAWTKeyStrokeForEvent(e); KeyStroke keyStroke = (KeyStroke) KeyStroke.getAWTKeyStrokeForEvent(e);
KeyStroke storeKeyStroke = DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().getShortCutKeyStore(); KeyStroke storeKeyStroke = DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().getShortCutKeyStore();
if (ComparatorUtils.equals(keyStroke.toString(), storeKeyStroke.toString()) && AlphaFinePane.getAlphaFinePane().isVisible()) { if (ComparatorUtils.equals(keyStroke.toString(), storeKeyStroke.toString()) && AlphaFineConfigManager.isALPHALicAvailable() && AlphaFinePane.getAlphaFinePane().isVisible()) {
doClickAction(); doClickAction();
} }
@ -129,7 +146,7 @@ public class AlphaFineDialog extends UIDialog {
private void initComponents() { private void initComponents() {
initSearchTextField(); initSearchTextField();
JPanel topPane = new JPanel(new BorderLayout()); JPanel topPane = new JPanel(new BorderLayout());
UILabel iconLabel = new UILabel(new ImageIcon(getClass().getResource("/com/fr/design/mainframe/alphafine/images/bigsearch.png"))); UILabel iconLabel = new UILabel(IconLoader.getIcon(AlphaFineConstants.IMAGE_URL + "bigsearch.png"));
iconLabel.setPreferredSize(AlphaFineConstants.ICON_LABEL_SIZE); iconLabel.setPreferredSize(AlphaFineConstants.ICON_LABEL_SIZE);
iconLabel.setOpaque(true); iconLabel.setOpaque(true);
iconLabel.setBackground(Color.WHITE); iconLabel.setBackground(Color.WHITE);
@ -144,7 +161,7 @@ public class AlphaFineDialog extends UIDialog {
} }
}; };
closeButton.setPreferredSize(AlphaFineConstants.CLOSE_BUTTON_SIZE); closeButton.setPreferredSize(AlphaFineConstants.CLOSE_BUTTON_SIZE);
closeButton.setIcon(new ImageIcon(getClass().getResource("/com/fr/design/mainframe/alphafine/images/alphafine_close.png"))); closeButton.setIcon(IconLoader.getIcon(AlphaFineConstants.IMAGE_URL + "alphafine_close.png"));
closeButton.set4ToolbarButton(); closeButton.set4ToolbarButton();
closeButton.setBorderPainted(false); closeButton.setBorderPainted(false);
closeButton.setRolloverEnabled(false); closeButton.setRolloverEnabled(false);
@ -156,12 +173,6 @@ public class AlphaFineDialog extends UIDialog {
}); });
topPane.add(closeButton, BorderLayout.EAST); topPane.add(closeButton, BorderLayout.EAST);
add(topPane, BorderLayout.CENTER); add(topPane, BorderLayout.CENTER);
searchTextField.getDocument().addDocumentListener(new DocumentAdapter() {
@Override
protected void textChanged(DocumentEvent e) {
doSearch(searchTextField.getText());
}
});
} }
/** /**
@ -169,7 +180,7 @@ public class AlphaFineDialog extends UIDialog {
*/ */
private void initSearchTextField() { private void initSearchTextField() {
searchTextField = new AlphaFineTextField(PLACE_HOLDER); searchTextField = new AlphaFineTextField(PLACE_HOLDER);
initTextFieldKeyListener(); initTextFieldListener();
searchTextField.setFont(AlphaFineConstants.GREATER_FONT); searchTextField.setFont(AlphaFineConstants.GREATER_FONT);
searchTextField.setBackground(Color.WHITE); searchTextField.setBackground(Color.WHITE);
searchTextField.setBorderPainted(false); searchTextField.setBorderPainted(false);
@ -223,16 +234,11 @@ public class AlphaFineDialog extends UIDialog {
* @param text * @param text
*/ */
private void doSearch(String text) { private void doSearch(String text) {
showSearchResult(text);
if (StringUtils.isBlank(text) || isNeedSearch(text)) {
removeSearchResult();
} else {
showSearchResult();
}
} }
boolean isNeedSearch(String text) { boolean isNoNeedSearch(String text) {
return ComparatorUtils.equals(PLACE_HOLDER, text) || text.contains("'"); return ComparatorUtils.equals(PLACE_HOLDER, text) || text.contains("'") || StringUtils.isBlank(text);
} }
@Override @Override
@ -267,17 +273,17 @@ public class AlphaFineDialog extends UIDialog {
searchResultPane = null; searchResultPane = null;
} }
setSize(AlphaFineConstants.FIELD_SIZE); setSize(AlphaFineConstants.FIELD_SIZE);
repaint(); refreshContainer();
} }
/** /**
* 展示搜索结果 * 展示搜索结果
*/ */
private void showSearchResult() { private void showSearchResult(String text) {
if (searchResultPane == null) { if (searchResultPane == null) {
initSearchResultComponents(); initSearchResultComponents();
} }
initSearchWorker(); initSearchWorker(text);
} }
/** /**
@ -294,20 +300,15 @@ public class AlphaFineDialog extends UIDialog {
searchResultList.setCellRenderer(new ContentCellRender()); searchResultList.setCellRenderer(new ContentCellRender());
leftSearchResultPane = new UIScrollPane(searchResultList); leftSearchResultPane = new UIScrollPane(searchResultList);
leftSearchResultPane.setBorder(null);
leftSearchResultPane.setBackground(Color.WHITE); leftSearchResultPane.setBackground(Color.WHITE);
leftSearchResultPane.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
leftSearchResultPane.setPreferredSize(new Dimension(AlphaFineConstants.LEFT_WIDTH, AlphaFineConstants.CONTENT_HEIGHT)); leftSearchResultPane.setPreferredSize(new Dimension(AlphaFineConstants.LEFT_WIDTH, AlphaFineConstants.CONTENT_HEIGHT));
rightSearchResultPane = new JPanel(); rightSearchResultPane = new JPanel();
rightSearchResultPane.setBackground(Color.WHITE); rightSearchResultPane.setBackground(Color.WHITE);
UILabel splitLine = new UILabel();
splitLine.setBackground(AlphaFineConstants.GRAY);
splitLine.setPreferredSize(new Dimension(1, AlphaFineConstants.CONTENT_HEIGHT));
rightSearchResultPane.setPreferredSize(new Dimension(AlphaFineConstants.RIGHT_WIDTH - 1, AlphaFineConstants.CONTENT_HEIGHT)); rightSearchResultPane.setPreferredSize(new Dimension(AlphaFineConstants.RIGHT_WIDTH - 1, AlphaFineConstants.CONTENT_HEIGHT));
searchResultPane.add(leftSearchResultPane, BorderLayout.WEST); searchResultPane.add(leftSearchResultPane, BorderLayout.WEST);
searchResultPane.add(splitLine, BorderLayout.CENTER);
searchResultPane.add(rightSearchResultPane, BorderLayout.EAST); searchResultPane.add(rightSearchResultPane, BorderLayout.EAST);
UILabel splitLabel = new UILabel(); splitLabel = new UILabel();
splitLabel.setBackground(AlphaFineConstants.GRAY);
splitLabel.setPreferredSize(new Dimension(AlphaFineConstants.HEIGHT, 1)); splitLabel.setPreferredSize(new Dimension(AlphaFineConstants.HEIGHT, 1));
searchResultPane.add(splitLabel, BorderLayout.NORTH); searchResultPane.add(splitLabel, BorderLayout.NORTH);
add(searchResultPane, BorderLayout.SOUTH); add(searchResultPane, BorderLayout.SOUTH);
@ -317,7 +318,7 @@ public class AlphaFineDialog extends UIDialog {
/** /**
* 异步加载搜索结果 * 异步加载搜索结果
*/ */
private void initSearchWorker() { private void initSearchWorker(final String text) {
if (this.searchWorker != null && !this.searchWorker.isDone()) { if (this.searchWorker != null && !this.searchWorker.isDone()) {
this.searchWorker.cancel(true); this.searchWorker.cancel(true);
this.searchWorker = null; this.searchWorker = null;
@ -325,13 +326,14 @@ public class AlphaFineDialog extends UIDialog {
this.searchWorker = new SwingWorker() { this.searchWorker = new SwingWorker() {
@Override @Override
protected Object doInBackground() throws Exception { protected Object doInBackground() throws Exception {
rebuildList(searchTextField.getText().toLowerCase()); rebuildList(text);
return null; return null;
} }
@Override @Override
protected void done() { protected void done() {
if (!isCancelled()) { if (!isCancelled()) {
splitLabel.setIcon(null);
fireStopLoading(); fireStopLoading();
} }
} }
@ -339,11 +341,45 @@ public class AlphaFineDialog extends UIDialog {
this.searchWorker.execute(); this.searchWorker.execute();
} }
/**
* 恢复左侧列表面板
*/
private void resumeLeftPane() {
if (searchResultPane != null && defaultPane != null) {
searchResultPane.remove(defaultPane);
defaultPane = null;
searchResultPane.add(leftSearchResultPane, BorderLayout.WEST);
}
}
/**
* 移除左侧列表面板
*/
private void removeLeftPane() {
if (searchListModel.isEmpty() && defaultPane == null) {
defaultPane = new NoResultPane(Inter.getLocText("FR-Designer-AlphaFine_NO_Result"), AlphaFineConstants.IMAGE_URL + "no_result.png");
searchResultPane.remove(leftSearchResultPane);
searchResultPane.add(defaultPane, BorderLayout.WEST);
refreshContainer();
}
}
/** /**
* 停止加载状态 * 停止加载状态
*/ */
private void fireStopLoading() { private void fireStopLoading() {
searchListModel.resetState(); if (searchResultPane != null) {
removeLeftPane();
}
}
/**
* 刷新容器
*/
private void refreshContainer() {
validate();
repaint();
revalidate();
} }
/** /**
@ -354,25 +390,26 @@ public class AlphaFineDialog extends UIDialog {
*/ */
private void rebuildList(String searchText) { private void rebuildList(String searchText) {
resetContainer(); resetContainer();
if (searchText.startsWith(ADVANCED_SEARCH_MARK)) { if (searchText.startsWith(ADVANCED_SEARCH_MARK)) {
if (searchText.startsWith(ACTION_MARK_SHORT) || searchText.startsWith(ACTION_MARK)) { if (searchText.startsWith(ACTION_MARK_SHORT) || searchText.startsWith(ACTION_MARK)) {
storeText = searchText.substring(searchText.indexOf(StringUtils.BLANK) + 1, searchText.length()); storeText = searchText.substring(searchText.indexOf(StringUtils.BLANK) + 1, searchText.length());
getActionList(storeText); buildActionList(storeText);
} else if (searchText.startsWith(DOCUMENT_MARK_SHORT) || searchText.startsWith(DOCUMENT_MARK)) { } else if (searchText.startsWith(DOCUMENT_MARK_SHORT) || searchText.startsWith(DOCUMENT_MARK)) {
storeText = searchText.substring(searchText.indexOf(StringUtils.BLANK) + 1, searchText.length()); storeText = searchText.substring(searchText.indexOf(StringUtils.BLANK) + 1, searchText.length());
getDocumentList(storeText); buildDocumentList(storeText);
} else if (searchText.startsWith(FILE_MARK_SHORT) || searchText.startsWith(FILE_MARK)) { } else if (searchText.startsWith(FILE_MARK_SHORT) || searchText.startsWith(FILE_MARK)) {
storeText = searchText.substring(searchText.indexOf(StringUtils.BLANK) + 1, searchText.length()); storeText = searchText.substring(searchText.indexOf(StringUtils.BLANK) + 1, searchText.length());
getFileList(storeText); buildFileList(storeText);
} else if (searchText.startsWith(CPT_MARK) || searchText.startsWith(FRM_MARK)) { } else if (searchText.startsWith(CPT_MARK) || searchText.startsWith(FRM_MARK)) {
storeText = searchText.substring(searchText.indexOf(StringUtils.BLANK) + 1, searchText.length()); storeText = searchText.substring(searchText.indexOf(StringUtils.BLANK) + 1, searchText.length());
getFileList(searchText); buildFileList(searchText);
} else if (searchText.startsWith(DS_MARK)) { } else if (searchText.startsWith(DS_MARK)) {
storeText = searchText.substring(searchText.indexOf(StringUtils.BLANK) + 1, searchText.length()); storeText = searchText.substring(searchText.indexOf(StringUtils.BLANK) + 1, searchText.length());
getFileList(DS_NAME + storeText); buildFileList(DS_NAME + storeText);
} else if (searchText.startsWith(PLUGIN_MARK_SHORT) || searchText.startsWith(PLUGIN_MARK)) { } else if (searchText.startsWith(PLUGIN_MARK_SHORT) || searchText.startsWith(PLUGIN_MARK)) {
storeText = searchText.substring(searchText.indexOf(StringUtils.BLANK) + 1, searchText.length()); storeText = searchText.substring(searchText.indexOf(StringUtils.BLANK) + 1, searchText.length());
getPluginList(storeText); buildPluginList(storeText);
} }
} else { } else {
storeText = searchText.trim(); storeText = searchText.trim();
@ -385,11 +422,12 @@ public class AlphaFineDialog extends UIDialog {
* 重置面板 * 重置面板
*/ */
private void resetContainer() { private void resetContainer() {
rightSearchResultPane.removeAll();
splitLabel.setIcon(new ImageIcon(getClass().getResource("/com/fr/design/mainframe/alphafine/images/bigloading.gif")));
resumeLeftPane();
searchListModel.removeAllElements(); searchListModel.removeAllElements();
searchListModel.resetSelectedState(); searchListModel.resetSelectedState();
rightSearchResultPane.removeAll(); refreshContainer();
validate();
repaint();
} }
/** /**
@ -398,23 +436,22 @@ public class AlphaFineDialog extends UIDialog {
* @param searchText * @param searchText
*/ */
private void doNormalSearch(String searchText) { private void doNormalSearch(String searchText) {
getRecentList(searchText); buildRecentList(searchText);
getRecommendList(searchText); buildRecommendList(searchText);
getActionList(searchText); buildActionList(searchText);
getFileList(searchText); buildFileList(searchText);
getDocumentList(searchText); buildDocumentList(searchText);
getPluginList(searchText); buildPluginList(searchText);
} }
private void getDocumentList(final String searchText) { private void buildDocumentList(final String searchText) {
SearchResult documentModelList = DocumentSearchManager.getDocumentSearchManager().getLessSearchResult(searchText); SearchResult documentModelList = DocumentSearchManager.getDocumentSearchManager().getLessSearchResult(searchText);
for (AlphaCellModel object : documentModelList) { for (AlphaCellModel object : documentModelList) {
AlphaFineHelper.checkCancel();
searchListModel.addElement(object); searchListModel.addElement(object);
} }
} }
private void getFileList(final String searchText) { private void buildFileList(final String searchText) {
SearchResult fileModelList = FileSearchManager.getFileSearchManager().getLessSearchResult(searchText); SearchResult fileModelList = FileSearchManager.getFileSearchManager().getLessSearchResult(searchText);
for (AlphaCellModel object : fileModelList) { for (AlphaCellModel object : fileModelList) {
AlphaFineHelper.checkCancel(); AlphaFineHelper.checkCancel();
@ -422,34 +459,30 @@ public class AlphaFineDialog extends UIDialog {
} }
} }
private void getActionList(final String searchText) { private void buildActionList(final String searchText) {
SearchResult actionModelList = ActionSearchManager.getActionSearchManager().getLessSearchResult(searchText); SearchResult actionModelList = ActionSearchManager.getActionSearchManager().getLessSearchResult(searchText);
for (AlphaCellModel object : actionModelList) { for (AlphaCellModel object : actionModelList) {
AlphaFineHelper.checkCancel();
searchListModel.addElement(object); searchListModel.addElement(object);
} }
} }
private void getPluginList(final String searchText) { private void buildPluginList(final String searchText) {
SearchResult pluginModelList = PluginSearchManager.getPluginSearchManager().getLessSearchResult(searchText); SearchResult pluginModelList = PluginSearchManager.getPluginSearchManager().getLessSearchResult(searchText);
for (AlphaCellModel object : pluginModelList) { for (AlphaCellModel object : pluginModelList) {
AlphaFineHelper.checkCancel();
searchListModel.addElement(object); searchListModel.addElement(object);
} }
} }
private void getRecommendList(final String searchText) { private void buildRecommendList(final String searchText) {
SearchResult recommendModelList = RecommendSearchManager.getRecommendSearchManager().getLessSearchResult(searchText); SearchResult recommendModelList = RecommendSearchManager.getRecommendSearchManager().getLessSearchResult(searchText);
for (AlphaCellModel object : recommendModelList) { for (AlphaCellModel object : recommendModelList) {
AlphaFineHelper.checkCancel();
searchListModel.addElement(object); searchListModel.addElement(object);
} }
} }
private void getRecentList(final String searchText) { private void buildRecentList(final String searchText) {
SearchResult recentModelList = RecentSearchManager.getRecentSearchManger().getLessSearchResult(searchText); SearchResult recentModelList = RecentSearchManager.getRecentSearchManger().getLessSearchResult(searchText);
for (AlphaCellModel object : recentModelList) { for (AlphaCellModel object : recentModelList) {
AlphaFineHelper.checkCancel();
searchListModel.addElement(object); searchListModel.addElement(object);
} }
@ -534,7 +567,7 @@ public class AlphaFineDialog extends UIDialog {
break; break;
case ACTION: case ACTION:
rightSearchResultPane.removeAll(); rightSearchResultPane.removeAll();
rightSearchResultPane.add(new ActionPreviewPane()); rightSearchResultPane.add(new NoResultPane(Inter.getLocText("FR-Designer_NoResult"), AlphaFineConstants.IMAGE_URL + "noresult.png"));
validate(); validate();
repaint(); repaint();
break; break;
@ -584,7 +617,7 @@ public class AlphaFineDialog extends UIDialog {
this.showWorker.execute(); this.showWorker.execute();
break; break;
default: default:
return; rightSearchResultPane.removeAll();
} }
@ -600,11 +633,10 @@ public class AlphaFineDialog extends UIDialog {
} }
} }
private void HandleMoreOrLessResult(int index, MoreModel selectedValue) { private void dealWithMoreOrLessResult(int index, MoreModel selectedValue) {
if (selectedValue.getContent().equals(Inter.getLocText("FR-Designer_AlphaFine_ShowAll"))) { if (ComparatorUtils.equals(Inter.getLocText("FR-Designer_AlphaFine_ShowAll"), selectedValue.getContent())) {
selectedValue.setContent(Inter.getLocText("FR-Designer_AlphaFine_ShowLess")); selectedValue.setContent(Inter.getLocText("FR-Designer_AlphaFine_ShowLess"));
rebuildShowMoreList(index, selectedValue); rebuildShowMoreList(index, selectedValue);
} else { } else {
selectedValue.setContent(Inter.getLocText("FR-Designer_AlphaFine_ShowAll")); selectedValue.setContent(Inter.getLocText("FR-Designer_AlphaFine_ShowAll"));
rebuildShowMoreList(index, selectedValue); rebuildShowMoreList(index, selectedValue);
@ -616,8 +648,7 @@ public class AlphaFineDialog extends UIDialog {
UILabel label = new UILabel(new ImageIcon(getClass().getResource("/com/fr/design/mainframe/alphafine/images/opening.gif"))); UILabel label = new UILabel(new ImageIcon(getClass().getResource("/com/fr/design/mainframe/alphafine/images/opening.gif")));
label.setBorder(BorderFactory.createEmptyBorder(120, 0, 0, 0)); label.setBorder(BorderFactory.createEmptyBorder(120, 0, 0, 0));
rightSearchResultPane.add(label, BorderLayout.CENTER); rightSearchResultPane.add(label, BorderLayout.CENTER);
validate(); refreshContainer();
repaint();
} }
/** /**
@ -625,34 +656,43 @@ public class AlphaFineDialog extends UIDialog {
*/ */
private void initGlobalListener() { private void initGlobalListener() {
initAWTEventListener(); initAWTEventListener();
initMouseListener();
} }
/** /**
* 为textfield添加键盘监听器 * 为textfield添加监听器
*/ */
private void initTextFieldKeyListener() { private void initTextFieldListener() {
searchTextField.addKeyListener(new KeyAdapter() { searchTextField.addKeyListener(new KeyAdapter() {
@Override @Override
public void keyPressed(KeyEvent e) { public void keyPressed(KeyEvent e) {
if (e.getKeyCode() == KeyEvent.VK_DOWN) { if (e.getKeyCode() == KeyEvent.VK_ENTER) {
searchResultList.requestFocus(); if (searchResultList.getModel().getSize() > 1) {
searchResultList.setSelectedIndex(searchResultList.getSelectedIndex() + 1); dealWithSearchResult(searchResultList.getSelectedValue());
} else if (e.getKeyCode() == KeyEvent.VK_ENTER) { }
doNavigate(); } else if (e.getKeyCode() == KeyEvent.VK_DOWN) {
saveHistory(searchResultList.getSelectedValue()); if (searchResultList.getSelectedIndex() == searchResultList.getModel().getSize() - 1) {
searchResultList.setSelectedIndex(0);
} }
searchResultList.setSelectedIndex(searchResultList.getSelectedIndex() + 1);
} else if (e.getKeyCode() == KeyEvent.VK_UP) {
searchResultList.setSelectedIndex(searchResultList.getSelectedIndex() - 1);
} else escAlphaFineDialog(e);
} }
});
searchTextField.getDocument().addDocumentListener(new DocumentAdapter() {
@Override @Override
public void keyReleased(KeyEvent e) { protected void textChanged(DocumentEvent e) {
int keyCode = e.getKeyCode(); if (isNoNeedSearch(searchTextField.getText())) {
if (keyCode == KeyEvent.VK_ESCAPE) { removeSearchResult();
if (StringUtils.isBlank(searchTextField.getText()) || ComparatorUtils.equals(searchTextField.getText(), searchTextField.getPlaceHolder())) {
AlphaFineDialog.this.setVisible(false);
} else { } else {
searchTextField.setText(null); try {
Thread.sleep(10);
doSearch(searchTextField.getText().toLowerCase());
} catch (InterruptedException e1) {
FRLogger.getLogger().error(e1.getMessage());
} }
} }
} }
}); });
@ -661,42 +701,13 @@ public class AlphaFineDialog extends UIDialog {
} }
/** /**
* 窗口拖拽 * 处理搜索结果
*
* @param selectedValue
*/ */
private void initMouseListener() { private void dealWithSearchResult(AlphaCellModel selectedValue) {
addMouseMotionListener(new MouseMotionAdapter() { doNavigate();
@Override saveLocalHistory(selectedValue);
public void mouseDragged(MouseEvent e) {
doMouseDragged(e);
}
});
addMouseListener(new MouseAdapter() {
public void mousePressed(MouseEvent e) {
doMousePressed(e);
}
});
}
private void doMousePressed(MouseEvent e) {
pressedPoint = e.getPoint();
}
private void doMouseDragged(MouseEvent e) {
Point point = e.getPoint();// 获取当前坐标
Point locationPoint = getLocation();// 获取窗体坐标
int x = locationPoint.x + point.x - pressedPoint.x;// 计算移动后的新坐标
int y = locationPoint.y + point.y - pressedPoint.y;
setLocation(x, y);// 改变窗体位置
} }
/** /**
@ -727,25 +738,30 @@ public class AlphaFineDialog extends UIDialog {
@Override @Override
public void checkValid() throws Exception { public void checkValid() throws Exception {
//不处理
} }
/**
* 导航到结果页面
*/
private void doNavigate() { private void doNavigate() {
AlphaFineDialog.this.dispose(); AlphaFineDialog.this.dispose();
final AlphaCellModel model = searchResultList.getSelectedValue(); final AlphaCellModel model = searchResultList.getSelectedValue();
if (model != null) {
model.doAction(); model.doAction();
} }
}
/** /**
* 保存本地本地常用 * 保存结果到本地本地常用
* *
* @param cellModel * @param cellModel
*/ */
private void saveHistory(AlphaCellModel cellModel) { private void saveLocalHistory(AlphaCellModel cellModel) {
RecentSearchManager recentSearchManager = RecentSearchManager.getRecentSearchManger(); RecentSearchManager recentSearchManager = RecentSearchManager.getRecentSearchManger();
recentSearchManager.addRecentModel(storeText, cellModel); recentSearchManager.addRecentModel(storeText, cellModel);
recentSearchManager.saveXMLFile(); recentSearchManager.saveXMLFile();
sendToServer(storeText, cellModel); sendDataToServer(storeText, cellModel);
} }
@ -755,9 +771,9 @@ public class AlphaFineDialog extends UIDialog {
* @param searchKey * @param searchKey
* @param cellModel * @param cellModel
*/ */
private void sendToServer(String searchKey, AlphaCellModel cellModel) { private void sendDataToServer(String searchKey, AlphaCellModel cellModel) {
if (cellModel.isNeedToSendToServer()) { if (cellModel.isNeedToSendToServer()) {
String username = DesignerEnvManager.getEnvManager().getBBSName(); String username = ConfigManager.getProviderInstance().getBbsUsername();
String uuid = DesignerEnvManager.getEnvManager().getUUID(); String uuid = DesignerEnvManager.getEnvManager().getUUID();
String activityKey = DesignerEnvManager.getEnvManager().getActivationKey(); String activityKey = DesignerEnvManager.getEnvManager().getActivationKey();
String createTime = new SimpleDateFormat("yyyy-MM-dd HH:mm").format(Calendar.getInstance().getTime()); String createTime = new SimpleDateFormat("yyyy-MM-dd HH:mm").format(Calendar.getInstance().getTime());
@ -772,14 +788,13 @@ public class AlphaFineDialog extends UIDialog {
} }
final HashMap<String, String> para = new HashMap<>(); final HashMap<String, String> para = new HashMap<>();
String date = new SimpleDateFormat("yyyy-MM-dd").format(Calendar.getInstance().getTime()); String date = new SimpleDateFormat("yyyy-MM-dd").format(Calendar.getInstance().getTime());
para.put("token", CodeUtils.md5Encode(date, "", "MD5")); para.put("token", CodeUtils.md5Encode(date, StringUtils.EMPTY, "MD5"));
para.put("content", object.toString()); para.put("content", object.toString());
HttpClient httpClient = new HttpClient(AlphaFineConstants.CLOUD_SERVER_URL, para, true); HttpClient httpClient = new HttpClient(AlphaFineConstants.CLOUD_SERVER_URL, para, true);
httpClient.asGet(); httpClient.asGet();
if (!httpClient.isServerAlive()) { if (!httpClient.isServerAlive()) {
FRLogger.getLogger().error("Failed to sent data to server!"); FRLogger.getLogger().error("Failed to sent data to server!");
} }
httpClient.setTimeout(5000);
} }
@ -860,6 +875,33 @@ public class AlphaFineDialog extends UIDialog {
this.storeText = storeText; this.storeText = storeText;
} }
public UILabel getSplitLabel() {
return splitLabel;
}
public void setSplitLabel(UILabel splitLabel) {
this.splitLabel = splitLabel;
}
/**
* 键盘退出AlphaFine
*
* @param e
*/
private void escAlphaFineDialog(KeyEvent e) {
if (e.getKeyCode() == KeyEvent.VK_ESCAPE) {
if (StringUtils.isBlank(searchTextField.getText()) || ComparatorUtils.equals(searchTextField.getText(), searchTextField.getPlaceHolder())) {
AlphaFineDialog.this.setVisible(false);
} else {
searchTextField.setText(null);
removeSearchResult();
}
} else if (e.getKeyCode() == KeyEvent.VK_ENTER) {
if (searchResultList.getModel().getSize() > 1) {
dealWithSearchResult(searchResultList.getSelectedValue());
}
}
}
/** /**
* +-------------------------------------+ * +-------------------------------------+
@ -879,7 +921,9 @@ public class AlphaFineDialog extends UIDialog {
*/ */
@Override @Override
public void setSelectedIndex(int index) { public void setSelectedIndex(int index) {
if (index > 0 && checkSelectedIndex(index)) { if (index == 0 && getModel().getSize() > 1) {
super.setSelectedIndex(1);
} else if (index > 0 && checkSelectedIndex(index)) {
int previousIndex = getSelectedIndex(); int previousIndex = getSelectedIndex();
super.setSelectedIndex(index); super.setSelectedIndex(index);
AlphaCellModel cellModel = getSelectedValue(); AlphaCellModel cellModel = getSelectedValue();
@ -902,31 +946,16 @@ public class AlphaFineDialog extends UIDialog {
} }
private void initListListener() { private void initListListener() {
addKeyListener(new KeyAdapter() {
@Override
public void keyPressed(KeyEvent e) {
if (e.getKeyCode() == KeyEvent.VK_ENTER) {
doNavigate();
saveHistory(getSelectedValue());
} else if (e.getKeyCode() == KeyEvent.VK_UP) {
if (getSelectedIndex() == 1) {
searchTextField.requestFocus();
}
}
}
});
addMouseListener(new MouseAdapter() { addMouseListener(new MouseAdapter() {
@Override @Override
public void mouseClicked(MouseEvent e) { public void mouseClicked(MouseEvent e) {
int selectedIndex = getSelectedIndex(); int selectedIndex = getSelectedIndex();
AlphaCellModel selectedValue = getSelectedValue(); AlphaCellModel selectedValue = getSelectedValue();
if (e.getClickCount() == 2 && selectedValue.hasAction()) { if (e.getClickCount() == 2 && selectedValue.hasAction()) {
doNavigate(); dealWithSearchResult(selectedValue);
saveHistory(selectedValue);
} else if (e.getClickCount() == 1) { } else if (e.getClickCount() == 1) {
if (selectedValue instanceof MoreModel && ((MoreModel) selectedValue).isNeedMore()) { if (selectedValue instanceof MoreModel && ((MoreModel) selectedValue).isNeedMore()) {
HandleMoreOrLessResult(selectedIndex, (MoreModel) selectedValue); dealWithMoreOrLessResult(selectedIndex, (MoreModel) selectedValue);
} }
} }
} }
@ -940,6 +969,14 @@ public class AlphaFineDialog extends UIDialog {
} }
} }
}); });
addKeyListener(new KeyAdapter() {
@Override
public void keyPressed(KeyEvent e) {
escAlphaFineDialog(e);
}
});
} }
} }
@ -962,10 +999,23 @@ public class AlphaFineDialog extends UIDialog {
@Override @Override
public void addElement(AlphaCellModel element) { public void addElement(AlphaCellModel element) {
AlphaFineHelper.checkCancel();
int index = myDelegate.size(); int index = myDelegate.size();
myDelegate.add(element); myDelegate.add(element);
fireContentsChanged(this, index, index); fireContentsChanged(this, index, index);
fireSelectedStateChanged(element, index); fireSelectedStateChanged(element, index);
}
@Override
protected void fireContentsChanged(Object source, int index0, int index1) {
if (myDelegate.size() > MAX_SHOW_SIZE) {
leftSearchResultPane.getVerticalScrollBar().setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 0));
leftSearchResultPane.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 2));
} else {
leftSearchResultPane.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
}
super.fireContentsChanged(source, index0, index1);
} }
/** /**
@ -1025,6 +1075,11 @@ public class AlphaFineDialog extends UIDialog {
isValidSelected = selected; isValidSelected = selected;
} }
@Override
public boolean isEmpty() {
return myDelegate.isEmpty();
}
public void resetState() { public void resetState() {
for (int i = 0; i < getSize(); i++) { for (int i = 0; i < getSize(); i++) {
getElementAt(i).resetState(); getElementAt(i).resetState();

18
designer/src/com/fr/design/mainframe/alphafine/component/AlphaFinePane.java

@ -1,16 +1,15 @@
package com.fr.design.mainframe.alphafine.component; package com.fr.design.mainframe.alphafine.component;
import com.fr.design.DesignerEnvManager; import com.bulenkov.iconloader.IconLoader;
import com.fr.design.actions.help.alphafine.AlphaFineContext; import com.fr.design.actions.help.alphafine.AlphaFineContext;
import com.fr.design.actions.help.alphafine.AlphaFineListener; import com.fr.design.actions.help.alphafine.AlphaFineListener;
import com.fr.design.constants.UIConstants;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.mainframe.alphafine.AlphaFineHelper; import com.fr.design.mainframe.alphafine.AlphaFineHelper;
import com.fr.design.utils.ThemeUtils; import com.fr.design.utils.ThemeUtils;
import com.fr.general.IOUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import javax.swing.*;
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;
@ -21,17 +20,20 @@ import java.awt.event.ActionListener;
public class AlphaFinePane extends BasicPane { public class AlphaFinePane extends BasicPane {
private static AlphaFinePane alphaFinePane; private static AlphaFinePane alphaFinePane;
public AlphaFinePane() { static {
setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 14));
if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isEnabled()) {
Toolkit.getDefaultToolkit().addAWTEventListener(AlphaFineDialog.listener(), AWTEvent.KEY_EVENT_MASK); Toolkit.getDefaultToolkit().addAWTEventListener(AlphaFineDialog.listener(), AWTEvent.KEY_EVENT_MASK);
} }
public AlphaFinePane() {
setPreferredSize(new Dimension(24, 24));
setLayout(new BorderLayout());
UIButton refreshButton = new UIButton(); UIButton refreshButton = new UIButton();
refreshButton.setIcon(IOUtils.readIcon("/com/fr/design/mainframe/alphafine/images/smallsearch.png")); refreshButton.setIcon(IconLoader.getIcon("/com/fr/design/mainframe/alphafine/images/smallsearch.png"));
refreshButton.setToolTipText(Inter.getLocText("FR-Designer_AlphaFine")); refreshButton.setToolTipText(Inter.getLocText("FR-Designer_AlphaFine"));
refreshButton.set4ToolbarButton(); refreshButton.set4ToolbarButton();
refreshButton.setRolloverEnabled(false);
this.add(refreshButton); this.add(refreshButton);
this.setBackground(ThemeUtils.WHITE_BORDER_COLOR); this.setBackground(UIConstants.TEMPLATE_TAB_PANE_BACKGROUND);
refreshButton.addActionListener(new ActionListener() { refreshButton.addActionListener(new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {

BIN
designer/src/com/fr/design/mainframe/alphafine/images/alphafine1@2x.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 738 B

BIN
designer/src/com/fr/design/mainframe/alphafine/images/alphafine2@2x.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 618 B

BIN
designer/src/com/fr/design/mainframe/alphafine/images/alphafine3@2x.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 303 B

BIN
designer/src/com/fr/design/mainframe/alphafine/images/alphafine4@2x.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 547 B

BIN
designer/src/com/fr/design/mainframe/alphafine/images/alphafine5@2x.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 323 B

BIN
designer/src/com/fr/design/mainframe/alphafine/images/alphafine_close@2x.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 371 B

BIN
designer/src/com/fr/design/mainframe/alphafine/images/bigloading.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

BIN
designer/src/com/fr/design/mainframe/alphafine/images/bigsearch.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 503 B

After

Width:  |  Height:  |  Size: 461 B

BIN
designer/src/com/fr/design/mainframe/alphafine/images/bigsearch@2x.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 761 B

BIN
designer/src/com/fr/design/mainframe/alphafine/images/no_result.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

BIN
designer/src/com/fr/design/mainframe/alphafine/images/no_result@2x.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

BIN
designer/src/com/fr/design/mainframe/alphafine/images/noresult@2x.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

BIN
designer/src/com/fr/design/mainframe/alphafine/images/opening@2x.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 331 KiB

BIN
designer/src/com/fr/design/mainframe/alphafine/images/selected1@2x.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 528 B

BIN
designer/src/com/fr/design/mainframe/alphafine/images/selected2@2x.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 488 B

BIN
designer/src/com/fr/design/mainframe/alphafine/images/selected3@2x.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 279 B

BIN
designer/src/com/fr/design/mainframe/alphafine/images/selected4@2x.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 430 B

BIN
designer/src/com/fr/design/mainframe/alphafine/images/selected5@2x.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 281 B

BIN
designer/src/com/fr/design/mainframe/alphafine/images/smallsearch.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 299 B

BIN
designer/src/com/fr/design/mainframe/alphafine/images/smallsearch@2x.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 539 B

37
designer/src/com/fr/design/mainframe/alphafine/preview/ActionPreviewPane.java

@ -1,37 +0,0 @@
package com.fr.design.mainframe.alphafine.preview;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.mainframe.alphafine.AlphaFineConstants;
import com.fr.general.IOUtils;
import com.fr.general.Inter;
import javax.swing.*;
import java.awt.*;
/**
* Created by XiaXiang on 2017/5/5.
*/
public class ActionPreviewPane extends JPanel {
private static final Font NAME = new Font("Song_TypeFace", 0, 14);
public ActionPreviewPane() {
setLayout(new BorderLayout());
setBackground(null);
setBorder(BorderFactory.createEmptyBorder(135, 0, 0, 0));
UILabel image = new UILabel();
image.setPreferredSize(new Dimension(150, 111));
image.setHorizontalAlignment(SwingConstants.CENTER);
image.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0));
image.setIcon(IOUtils.readIcon("/com/fr/design/mainframe/alphafine/images/noresult.png"));
UILabel description = new UILabel(Inter.getLocText("FR-Designer_NoResult"));
description.setForeground(AlphaFineConstants.MEDIUM_GRAY);
description.setFont(NAME);
description.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0));
description.setHorizontalAlignment(SwingConstants.CENTER);
this.add(image, BorderLayout.CENTER);
this.add(description, BorderLayout.SOUTH);
}
}

29
designer/src/com/fr/design/mainframe/alphafine/preview/DocumentPreviewPane.java

@ -3,7 +3,6 @@ package com.fr.design.mainframe.alphafine.preview;
import com.fr.design.gui.itextarea.UITextArea; import com.fr.design.gui.itextarea.UITextArea;
import com.fr.design.mainframe.alphafine.AlphaFineConstants; import com.fr.design.mainframe.alphafine.AlphaFineConstants;
import com.fr.design.utils.gui.GUICoreUtils;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;
@ -16,30 +15,18 @@ public class DocumentPreviewPane extends JPanel {
public DocumentPreviewPane(String title, String summary) { public DocumentPreviewPane(String title, String summary) {
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout());
this.setBackground(Color.WHITE); this.setBackground(Color.WHITE);
this.setPreferredSize(new Dimension(AlphaFineConstants.RIGHT_WIDTH, AlphaFineConstants.CONTENT_HEIGHT));
UITextArea titleArea = new UITextArea(title); UITextArea titleArea = new UITextArea(title);
UITextArea contentArea = new UITextArea(summary); titleArea.setBorder(null);
titleArea.setOpaque(false); titleArea.setEditable(false);
contentArea.setOpaque(false);
titleArea.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
titleArea.setForeground(AlphaFineConstants.BLUE); titleArea.setForeground(AlphaFineConstants.BLUE);
contentArea.setForeground(AlphaFineConstants.BLACK);
titleArea.setPreferredSize(new Dimension(360, 30));
titleArea.setFont(AlphaFineConstants.LARGE_FONT); titleArea.setFont(AlphaFineConstants.LARGE_FONT);
contentArea.setFont(AlphaFineConstants.MEDIUM_FONT);
add(titleArea, BorderLayout.NORTH); add(titleArea, BorderLayout.NORTH);
UITextArea contentArea = new UITextArea(summary);
contentArea.setEditable(false);
contentArea.setBorder(null);
contentArea.setForeground(AlphaFineConstants.BLACK);
contentArea.setFont(AlphaFineConstants.MEDIUM_FONT);
add(contentArea, BorderLayout.CENTER); add(contentArea, BorderLayout.CENTER);
} }
public static void main(String[] args) {
JFrame jf = new JFrame("test");
jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JPanel content = (JPanel) jf.getContentPane();
content.setLayout(null);
content.add(new DocumentPreviewPane("test", "ababababaabbababab"));
GUICoreUtils.centerWindow(jf);
jf.setSize(400, 400);
jf.setVisible(true);
}
} }

32
designer/src/com/fr/design/mainframe/alphafine/preview/NoResultPane.java

@ -0,0 +1,32 @@
package com.fr.design.mainframe.alphafine.preview;
import com.bulenkov.iconloader.IconLoader;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.mainframe.alphafine.AlphaFineConstants;
import com.fr.general.FRFont;
import javax.swing.*;
import java.awt.*;
/**
* Created by XiaXiang on 2017/8/14.
*/
public class NoResultPane extends JPanel {
public NoResultPane(String title, String iconUrl) {
setLayout(new BorderLayout());
setBackground(Color.white);
setPreferredSize(new Dimension(AlphaFineConstants.LEFT_WIDTH, AlphaFineConstants.CONTENT_HEIGHT));
UILabel image = new UILabel();
image.setPreferredSize(new Dimension(150, 111));
image.setHorizontalAlignment(SwingConstants.CENTER);
image.setIcon(IconLoader.getIcon(iconUrl));
image.setBorder(BorderFactory.createEmptyBorder(100, 0, 0, 0));
UILabel description = new UILabel(title);
description.setForeground(AlphaFineConstants.MEDIUM_GRAY);
description.setFont(FRFont.getInstance("SimSun", Font.PLAIN, 14));
description.setBorder(BorderFactory.createEmptyBorder(0, 0, 135, 0));
description.setHorizontalAlignment(SwingConstants.CENTER);
add(image, BorderLayout.CENTER);
add(description, BorderLayout.SOUTH);
}
}

4
designer/src/com/fr/design/mainframe/alphafine/preview/PluginPreviewPane.java

@ -49,10 +49,10 @@ public class PluginPreviewPane extends JPanel {
nameLabel.setBackground(AlphaFineConstants.BLUE); nameLabel.setBackground(AlphaFineConstants.BLUE);
nameLabel.setBorder(BorderFactory.createEmptyBorder(20, 20, 10, 20)); nameLabel.setBorder(BorderFactory.createEmptyBorder(20, 20, 10, 20));
line.setBorder(BorderFactory.createEmptyBorder(20, 0, 10, 0)); line.setBorder(BorderFactory.createEmptyBorder(20, 0, 10, 0));
String price0 = price == 0 ? Inter.getLocText("FR-Designer-Collect_Information_free") : String.valueOf(price); String price0 = price == 0 ? Inter.getLocText("FR-Designer-Collect_Information_free") : "¥" + String.valueOf(price);
UILabel priceLabel = new UILabel(price0); UILabel priceLabel = new UILabel(price0);
priceLabel.setForeground(AlphaFineConstants.RED); priceLabel.setForeground(AlphaFineConstants.RED);
priceLabel.setFont(AlphaFineConstants.SMALL_FONT); priceLabel.setFont(AlphaFineConstants.MEDIUM_FONT);
bottomPane.add(priceLabel, BorderLayout.WEST); bottomPane.add(priceLabel, BorderLayout.WEST);
panel.add(nameLabel, BorderLayout.NORTH); panel.add(nameLabel, BorderLayout.NORTH);
panel.add(line, BorderLayout.SOUTH); panel.add(line, BorderLayout.SOUTH);

9
designer/src/com/fr/design/mainframe/alphafine/search/manager/ActionSearchManager.java

@ -74,15 +74,12 @@ public class ActionSearchManager implements AlphaFineSearchProcessor {
if (!AlphaFineHelper.getFilterResult().contains(object)) { if (!AlphaFineHelper.getFilterResult().contains(object)) {
result.add(object); result.add(object);
} }
} }
if (result.size() < AlphaFineConstants.SHOW_SIZE + 1) { if (result.isEmpty()) {
return lessModelList;
} else if (result.size() < AlphaFineConstants.SHOW_SIZE + 1) {
lessModelList.add(0, new MoreModel(Inter.getLocText("FR-Designer_Set"))); lessModelList.add(0, new MoreModel(Inter.getLocText("FR-Designer_Set")));
if (result.size() == 0) {
lessModelList.add(AlphaFineHelper.NO_RESULT_MODEL);
} else {
lessModelList.addAll(result); lessModelList.addAll(result);
}
} else { } else {
lessModelList.add(0, new MoreModel(Inter.getLocText("FR-Designer_Set"), Inter.getLocText("FR-Designer_AlphaFine_ShowAll"), true, CellType.ACTION)); lessModelList.add(0, new MoreModel(Inter.getLocText("FR-Designer_Set"), Inter.getLocText("FR-Designer_AlphaFine_ShowAll"), true, CellType.ACTION));
lessModelList.addAll(result.subList(0, AlphaFineConstants.SHOW_SIZE)); lessModelList.addAll(result.subList(0, AlphaFineConstants.SHOW_SIZE));

10
designer/src/com/fr/design/mainframe/alphafine/search/manager/DocumentSearchManager.java

@ -61,7 +61,6 @@ public class DocumentSearchManager implements AlphaFineSearchProcessor {
if (!httpClient.isServerAlive()) { if (!httpClient.isServerAlive()) {
return getNoConnectList(); return getNoConnectList();
} }
httpClient.setTimeout(5000);
result = httpClient.getResponseText(); result = httpClient.getResponseText();
AlphaFineHelper.checkCancel(); AlphaFineHelper.checkCancel();
try { try {
@ -76,13 +75,11 @@ public class DocumentSearchManager implements AlphaFineSearchProcessor {
searchResult.add(cellModel); searchResult.add(cellModel);
} }
} }
if (searchResult.size() < AlphaFineConstants.SHOW_SIZE + 1) { if (searchResult.isEmpty()) {
return lessModelList;
} else if (searchResult.size() < AlphaFineConstants.SHOW_SIZE + 1) {
lessModelList.add(0, new MoreModel(Inter.getLocText("FR-Designer_COMMUNITY_HELP"))); lessModelList.add(0, new MoreModel(Inter.getLocText("FR-Designer_COMMUNITY_HELP")));
if (searchResult.size() == 0) {
lessModelList.add(AlphaFineHelper.NO_RESULT_MODEL);
} else {
lessModelList.addAll(searchResult); lessModelList.addAll(searchResult);
}
} else { } else {
lessModelList.add(0, new MoreModel(Inter.getLocText("FR-Designer_COMMUNITY_HELP"), Inter.getLocText("FR-Designer_AlphaFine_ShowAll"), true, CellType.DOCUMENT)); lessModelList.add(0, new MoreModel(Inter.getLocText("FR-Designer_COMMUNITY_HELP"), Inter.getLocText("FR-Designer_AlphaFine_ShowAll"), true, CellType.DOCUMENT));
lessModelList.addAll(searchResult.subList(0, AlphaFineConstants.SHOW_SIZE)); lessModelList.addAll(searchResult.subList(0, AlphaFineConstants.SHOW_SIZE));
@ -91,7 +88,6 @@ public class DocumentSearchManager implements AlphaFineSearchProcessor {
} }
} catch (JSONException e) { } catch (JSONException e) {
FRLogger.getLogger().error("document search error: " + e.getMessage()); FRLogger.getLogger().error("document search error: " + e.getMessage());
return lessModelList;
} }
} }
return lessModelList; return lessModelList;

16
designer/src/com/fr/design/mainframe/alphafine/search/manager/FileSearchManager.java

@ -19,7 +19,12 @@ import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.project.ProjectConstants; import com.fr.stable.project.ProjectConstants;
import java.io.*; import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -83,6 +88,7 @@ public class FileSearchManager implements AlphaFineSearchProcessor {
Env env = FRContext.getCurrentEnv(); Env env = FRContext.getCurrentEnv();
fileNodes = new ArrayList<>(); fileNodes = new ArrayList<>();
fileNodes = listTpl(env, ProjectConstants.REPORTLETS_NAME, true); fileNodes = listTpl(env, ProjectConstants.REPORTLETS_NAME, true);
AlphaFineHelper.checkCancel();
isContainCpt = true; isContainCpt = true;
isContainFrm = true; isContainFrm = true;
for (FileNode node : fileNodes) { for (FileNode node : fileNodes) {
@ -100,13 +106,11 @@ public class FileSearchManager implements AlphaFineSearchProcessor {
} }
} }
if (result.size() < AlphaFineConstants.SHOW_SIZE + 1) { if (result.isEmpty()) {
return lessModelList;
} else if (result.size() < AlphaFineConstants.SHOW_SIZE + 1) {
lessModelList.add(0, new MoreModel(Inter.getLocText("FR-Designer_Templates"))); lessModelList.add(0, new MoreModel(Inter.getLocText("FR-Designer_Templates")));
if (result.size() == 0) {
lessModelList.add(AlphaFineHelper.NO_RESULT_MODEL);
} else {
lessModelList.addAll(result); lessModelList.addAll(result);
}
} else { } else {
lessModelList.add(0, new MoreModel(Inter.getLocText("FR-Designer_Templates"), Inter.getLocText("FR-Designer_AlphaFine_ShowAll"), true, CellType.FILE)); lessModelList.add(0, new MoreModel(Inter.getLocText("FR-Designer_Templates"), Inter.getLocText("FR-Designer_AlphaFine_ShowAll"), true, CellType.FILE));
lessModelList.addAll(result.subList(0, AlphaFineConstants.SHOW_SIZE)); lessModelList.addAll(result.subList(0, AlphaFineConstants.SHOW_SIZE));

10
designer/src/com/fr/design/mainframe/alphafine/search/manager/PluginSearchManager.java

@ -96,7 +96,6 @@ public class PluginSearchManager implements AlphaFineSearchProcessor {
if (!httpClient.isServerAlive()) { if (!httpClient.isServerAlive()) {
return getNoConnectList(); return getNoConnectList();
} }
httpClient.setTimeout(5000);
result = httpClient.getResponseText(); result = httpClient.getResponseText();
AlphaFineHelper.checkCancel(); AlphaFineHelper.checkCancel();
JSONObject jsonObject = new JSONObject(result); JSONObject jsonObject = new JSONObject(result);
@ -104,18 +103,17 @@ public class PluginSearchManager implements AlphaFineSearchProcessor {
if (jsonArray != null) { if (jsonArray != null) {
SearchResult searchResult = new SearchResult(); SearchResult searchResult = new SearchResult();
for (int i = 0; i < jsonArray.length(); i++) { for (int i = 0; i < jsonArray.length(); i++) {
AlphaFineHelper.checkCancel();
PluginModel cellModel = getPluginModel(jsonArray.optJSONObject(i), false); PluginModel cellModel = getPluginModel(jsonArray.optJSONObject(i), false);
if (!AlphaFineHelper.getFilterResult().contains(cellModel)) { if (!AlphaFineHelper.getFilterResult().contains(cellModel)) {
searchResult.add(cellModel); searchResult.add(cellModel);
} }
} }
if (searchResult.size() < AlphaFineConstants.SHOW_SIZE + 1) { if (searchResult.isEmpty()) {
return this.lessModelList;
} else if (searchResult.size() < AlphaFineConstants.SHOW_SIZE + 1) {
lessModelList.add(0, new MoreModel(Inter.getLocText("FR-Designer-Plugin_Addon"))); lessModelList.add(0, new MoreModel(Inter.getLocText("FR-Designer-Plugin_Addon")));
if (searchResult.size() == 0) {
lessModelList.add(AlphaFineHelper.NO_RESULT_MODEL);
} else {
lessModelList.addAll(searchResult); lessModelList.addAll(searchResult);
}
} else { } else {
lessModelList.add(0, new MoreModel(Inter.getLocText("FR-Designer-Plugin_Addon"), Inter.getLocText("FR-Designer_AlphaFine_ShowAll"), true, CellType.PLUGIN)); lessModelList.add(0, new MoreModel(Inter.getLocText("FR-Designer-Plugin_Addon"), Inter.getLocText("FR-Designer_AlphaFine_ShowAll"), true, CellType.PLUGIN));
lessModelList.addAll(searchResult.subList(0, AlphaFineConstants.SHOW_SIZE)); lessModelList.addAll(searchResult.subList(0, AlphaFineConstants.SHOW_SIZE));

29
designer/src/com/fr/design/mainframe/alphafine/search/manager/RecentSearchManager.java

@ -10,6 +10,7 @@ import com.fr.design.mainframe.alphafine.cell.model.ActionModel;
import com.fr.design.mainframe.alphafine.cell.model.AlphaCellModel; import com.fr.design.mainframe.alphafine.cell.model.AlphaCellModel;
import com.fr.design.mainframe.alphafine.cell.model.MoreModel; import com.fr.design.mainframe.alphafine.cell.model.MoreModel;
import com.fr.design.mainframe.alphafine.model.SearchResult; import com.fr.design.mainframe.alphafine.model.SearchResult;
import com.fr.design.mainframe.toolbar.UpdateActionManager;
import com.fr.file.XMLFileManager; import com.fr.file.XMLFileManager;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.FRLogger; import com.fr.general.FRLogger;
@ -26,8 +27,17 @@ import com.fr.stable.xml.XMLReadable;
import com.fr.stable.xml.XMLTools; import com.fr.stable.xml.XMLTools;
import com.fr.stable.xml.XMLableReader; import com.fr.stable.xml.XMLableReader;
import java.io.*; import java.io.File;
import java.util.*; import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.OutputStream;
import java.io.StringReader;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
/** /**
* Created by XiaXiang on 2017/5/15. * Created by XiaXiang on 2017/5/15.
@ -220,21 +230,24 @@ public class RecentSearchManager extends XMLFileManager implements AlphaFineSear
recentModelList = recentKVModelMap.get(searchText); recentModelList = recentKVModelMap.get(searchText);
SearchResult resultModelList = recentModelList; SearchResult resultModelList = recentModelList;
Iterator<AlphaCellModel> modelIterator = resultModelList.iterator(); Iterator<AlphaCellModel> modelIterator = resultModelList.iterator();
SearchResult searchResult = new SearchResult();
while (modelIterator.hasNext()) { while (modelIterator.hasNext()) {
AlphaCellModel model = modelIterator.next(); AlphaCellModel model = modelIterator.next();
if (model.getType() == CellType.ACTION && !((ActionModel) model).getAction().isEnabled()) { if (model.getType() == CellType.ACTION && !UpdateActionManager.getUpdateActionManager().isEnable(((ActionModel) model).getAction())) {
modelIterator.remove(); continue;
} else {
searchResult.add(model);
} }
} }
Collections.sort(resultModelList); Collections.sort(searchResult);
int size = resultModelList.size(); int size = searchResult.size();
if (size > MAX_SIZE) { if (size > MAX_SIZE) {
SearchResult result = new SearchResult(); SearchResult result = new SearchResult();
result.addAll(resultModelList.subList(0, MAX_SIZE)); result.addAll(searchResult.subList(0, MAX_SIZE));
return result; return result;
} }
return resultModelList; return searchResult;
} }
} }
return recentModelList; return recentModelList;

2
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.JSONException;
import com.fr.json.JSONObject; import com.fr.json.JSONObject;
import com.fr.stable.CodeUtils; import com.fr.stable.CodeUtils;
import com.fr.stable.StringUtils;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
@ -37,6 +38,7 @@ public class RecommendSearchManager implements AlphaFineSearchProcessor {
@Override @Override
public synchronized SearchResult getLessSearchResult(String searchText) { public synchronized SearchResult getLessSearchResult(String searchText) {
searchText = searchText.replaceAll(StringUtils.BLANK, StringUtils.EMPTY);
this.modelList = new SearchResult(); this.modelList = new SearchResult();
this.recommendModelList = new SearchResult(); this.recommendModelList = new SearchResult();
if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isContainRecommend()) { if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isContainRecommend()) {

32
designer/src/com/fr/design/mainframe/bbs/BBSConstants.java

@ -4,13 +4,13 @@
package com.fr.design.mainframe.bbs; package com.fr.design.mainframe.bbs;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import com.fr.general.SiteCenter;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import java.util.Properties; import java.util.Properties;
/** /**
* @author neil * @author neil
*
* @date: 2015-3-10-上午9:50:13 * @date: 2015-3-10-上午9:50:13
*/ */
public class BBSConstants { public class BBSConstants {
@ -20,25 +20,35 @@ public class BBSConstants {
private static final String GUEST_KEY = "USER"; private static final String GUEST_KEY = "USER";
private static final String GUEST_KEY_ONLINE = "guest.user";
private static final String LINK_KEY = "LINK"; private static final String LINK_KEY = "LINK";
private static final int GUEST_NUM = 5; private static final String LINK_KEY_ONLINE = "guest.link";
//用户名信息数组
public static final String[] ALL_GUEST = loadAllGuestsInfo(GUEST_KEY);
//用户论坛链接信息
public static final String[] ALL_LINK = loadAllGuestsInfo(LINK_KEY);
private static Properties PROP = null; private static Properties PROP = null;
public static String[] getAllGuest() {
return loadAllGuestsInfoOnline(GUEST_KEY_ONLINE, loadAllGuestsInfo(GUEST_KEY));
}
public static String[] getAllLink() {
return loadAllGuestsInfoOnline(LINK_KEY_ONLINE, loadAllGuestsInfo(LINK_KEY));
}
//加载所有用户的信息, 用户名, 论坛连接 //加载所有用户的信息, 用户名, 论坛连接
private static String[] loadAllGuestsInfo(String key){ private static String loadAllGuestsInfo(String key) {
String[] allGuests = new String[GUEST_NUM]; return loadAttribute(key, StringUtils.EMPTY);
for (int i = 0; i < GUEST_NUM; i++) {
allGuests[i] = loadAttribute(key + i, StringUtils.EMPTY);
} }
//加载所有用户的信息, 用户名, 论坛连接
private static String[] loadAllGuestsInfoOnline(String key, String defaultValue) {
String[] allGuests = new String[0];
String guest = SiteCenter.getInstance().acquireUrlByKind(key, defaultValue);
if (StringUtils.isNotEmpty(guest)) {
allGuests = guest.split("\\|");
}
return allGuests; return allGuests;
} }
//如果要定制, 直接改bbs.properties就行了 //如果要定制, 直接改bbs.properties就行了
private static String loadAttribute(String key, String defaultValue) { private static String loadAttribute(String key, String defaultValue) {
if (PROP == null) { if (PROP == null) {

24
designer/src/com/fr/design/mainframe/bbs/BBSGuestPane.java

@ -3,15 +3,6 @@
*/ */
package com.fr.design.mainframe.bbs; package com.fr.design.mainframe.bbs;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Desktop;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.net.URI;
import javax.swing.JPanel;
import com.fr.design.gui.ilable.ActionLabel; import com.fr.design.gui.ilable.ActionLabel;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
@ -21,6 +12,12 @@ import com.fr.general.Inter;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.start.BBSGuestPaneProvider; import com.fr.start.BBSGuestPaneProvider;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.net.URI;
/** /**
* @author neil * @author neil
* *
@ -54,9 +51,12 @@ public class BBSGuestPane extends JPanel implements BBSGuestPaneProvider{
double[] colSize = {p}; double[] colSize = {p};
Component[][] components = new Component[rowSize.length][colSize.length]; Component[][] components = new Component[rowSize.length][colSize.length];
for (int i = 0; i < components.length; i++) { String[] allGuest = BBSConstants.getAllGuest();
String userName = BBSConstants.ALL_GUEST[i]; String[] allLink = BBSConstants.getAllLink();
String url = BBSConstants.ALL_LINK[i]; int min = Math.min(allGuest.length, components.length);
for (int i = 0; i < min; i++) {
String userName = allGuest[i];
String url = allLink[i];
components[i][0] = getURLActionLabel(userName, url); components[i][0] = getURLActionLabel(userName, url);
} }

8
designer/src/com/fr/design/mainframe/bbs/BBSLoginDialog.java

@ -1,6 +1,8 @@
package com.fr.design.mainframe.bbs; package com.fr.design.mainframe.bbs;
import com.fr.design.DesignerEnvManager; import com.fr.base.ConfigManager;
import com.fr.base.FRContext;
import com.fr.design.bbs.BBSLoginUtils;
import com.fr.design.dialog.UIDialog; import com.fr.design.dialog.UIDialog;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ilable.ActionLabel; import com.fr.design.gui.ilable.ActionLabel;
@ -207,8 +209,8 @@ public class BBSLoginDialog extends UIDialog {
// 登录成功 // 登录成功
private void loginSuccess() { private void loginSuccess() {
DesignerEnvManager.getEnvManager().setBBSPassword(String.valueOf(passField.getPassword())); String password = String.valueOf(passField.getPassword());
userInfoLabel.setUserName(nameField.getText()); BBSLoginUtils.bbsLogin(nameField.getText(), password);
userInfoLabel.getUserInfoPane().markSignIn(nameField.getText()); userInfoLabel.getUserInfoPane().markSignIn(nameField.getText());
BBSLoginDialog.this.setVisible(false); BBSLoginDialog.this.setVisible(false);
} }

6
designer/src/com/fr/design/mainframe/bbs/ExitLabel.java

@ -9,14 +9,13 @@ import java.awt.event.MouseEvent;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.design.DesignerEnvManager; import com.fr.design.bbs.BBSLoginUtils;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.imenu.UIMenuItem; import com.fr.design.gui.imenu.UIMenuItem;
import com.fr.design.gui.imenu.UIPopupMenu; import com.fr.design.gui.imenu.UIPopupMenu;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.stable.StringUtils;
/** /**
* @author neil * @author neil
@ -61,8 +60,7 @@ public class ExitLabel extends UILabel{
} }
private void clearLoingInformation(){ private void clearLoingInformation(){
DesignerEnvManager.getEnvManager().setBBSName(StringUtils.EMPTY); BBSLoginUtils.bbsLogout();
DesignerEnvManager.getEnvManager().setBBSPassword(StringUtils.EMPTY);
} }
private void updateInfoPane(){ private void updateInfoPane(){

101
designer/src/com/fr/design/mainframe/bbs/UserInfoLabel.java

@ -3,35 +3,48 @@
*/ */
package com.fr.design.mainframe.bbs; package com.fr.design.mainframe.bbs;
import com.fr.base.ConfigManager;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.extra.*; import com.fr.design.bbs.BBSLoginUtils;
import com.fr.design.extra.LoginContextListener;
import com.fr.design.extra.LoginWebBridge;
import com.fr.design.extra.PluginWebBridge;
import com.fr.design.extra.UserLoginContext;
import com.fr.design.extra.WebViewDlgHelper;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.imenu.UIMenuItem; import com.fr.design.gui.imenu.UIMenuItem;
import com.fr.design.gui.imenu.UIPopupMenu; import com.fr.design.gui.imenu.UIPopupMenu;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.utils.concurrent.ThreadFactoryBuilder;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.DateUtils; import com.fr.general.DateUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.general.SiteCenter; import com.fr.general.SiteCenter;
import com.fr.general.http.HttpClient; import com.fr.general.http.HttpClient;
import com.fr.plugin.manage.bbs.BBSPluginLogin;
import com.fr.plugin.manage.bbs.BBSUserInfo;
import com.fr.stable.EncodeConstants; import com.fr.stable.EncodeConstants;
import com.fr.stable.OperatingSystem; import com.fr.stable.OperatingSystem;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.*; import javax.swing.SwingConstants;
import java.awt.*; import java.awt.Cursor;
import java.awt.Desktop;
import java.awt.Frame;
import java.awt.event.MouseAdapter; import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
import java.net.URI; import java.net.URI;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
/** /**
* @author neil * @author neil
@ -39,6 +52,7 @@ import java.util.Date;
*/ */
public class UserInfoLabel extends UILabel { public class UserInfoLabel extends UILabel {
private static final int VERSION_8 = 8;
//默认查询消息时间, 30s //默认查询消息时间, 30s
private static final long CHECK_MESSAGE_TIME = 30 * 1000L; private static final long CHECK_MESSAGE_TIME = 30 * 1000L;
//默认论坛检测到更新后的弹出延迟时间 //默认论坛检测到更新后的弹出延迟时间
@ -75,41 +89,26 @@ public class UserInfoLabel extends UILabel {
} }
public UserInfoLabel(UserInfoPane userInfoPane) { public UserInfoLabel(UserInfoPane userInfoPane) {
init(userInfoPane);
}
private void init(UserInfoPane userInfoPane) {
this.userInfoPane = userInfoPane; this.userInfoPane = userInfoPane;
String userName = DesignerEnvManager.getEnvManager().getBBSName(); String userName = ConfigManager.getProviderInstance().getBbsUsername();
this.addMouseListener(userInfoAdapter); this.addMouseListener(userInfoAdapter);
this.setHorizontalAlignment(SwingConstants.CENTER); this.setHorizontalAlignment(SwingConstants.CENTER);
this.setText(userName); this.setText(userName);
LoginWebBridge loginWebBridge = new LoginWebBridge(); if (StableUtils.getMajorJavaVersion() == VERSION_8) {
loginWebBridge.setUserName(userName, UserInfoLabel.this); LoginWebBridge.getHelper().setUILabel(UserInfoLabel.this);
LoginCheckContext.addLoginCheckListener(new LoginCheckListener() {
@Override
public void loginChecked() {
/*
if (bbsLoginDialog == null) {
bbsLoginDialog = new BBSLoginDialog(DesignerContext.getDesignerFrame(), UserInfoLabel.this);
}
bbsLoginDialog.clearLoginInformation();
bbsLoginDialog.showTipForDownloadPluginWithoutLogin();
bbsLoginDialog.setModal(true);
bbsLoginDialog.showWindow();
*/
}
});
if (StableUtils.getMajorJavaVersion() == 8) {
PluginWebBridge.getHelper().setUILabel(UserInfoLabel.this); PluginWebBridge.getHelper().setUILabel(UserInfoLabel.this);
} }
LoginWebBridge.getHelper().setUILabelInPlugin(UserInfoLabel.this);
UserLoginContext.addLoginContextListener(new LoginContextListener() { UserLoginContext.addLoginContextListener(new LoginContextListener() {
@Override @Override
public void showLoginContext() { public void showLoginContext() {
WebViewDlgHelper.createLoginDialog(); WebViewDlgHelper.createLoginDialog();
LoginWebBridge.getHelper().setUILabel(UserInfoLabel.this);
clearLoginInformation(); clearLoginInformation();
updateInfoPane(); updateInfoPane();
} }
@ -117,10 +116,7 @@ public class UserInfoLabel extends UILabel {
} }
private void clearLoginInformation() { private void clearLoginInformation() {
DesignerEnvManager.getEnvManager().setBBSName(StringUtils.EMPTY); BBSLoginUtils.bbsLogout();
DesignerEnvManager.getEnvManager().setBBSPassword(StringUtils.EMPTY);
DesignerEnvManager.getEnvManager().setInShowBBsName(StringUtils.EMPTY);
DesignerEnvManager.getEnvManager().setBbsUid(DEFAULT_BBS_UID);
} }
private void updateInfoPane() { private void updateInfoPane() {
@ -131,8 +127,13 @@ public class UserInfoLabel extends UILabel {
* showBBSDialog 弹出BBS资讯框 * showBBSDialog 弹出BBS资讯框
*/ */
public static void showBBSDialog() { public static void showBBSDialog() {
Thread showBBSThread = new Thread(new Runnable() { ThreadFactory namedThreadFactory = new ThreadFactoryBuilder()
.setNameFormat("bbs-dlg-thread-%s").build();
ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(
1, 1,
0L, TimeUnit.MILLISECONDS,
new LinkedBlockingQueue<Runnable>(1), namedThreadFactory);
threadPoolExecutor.execute(new Runnable() {
@Override @Override
public void run() { public void run() {
// vito:最新mac10.12和javafx弹出框初始化时会有大几率卡死在native方法,这里先屏蔽一下。 // vito:最新mac10.12和javafx弹出框初始化时会有大几率卡死在native方法,这里先屏蔽一下。
@ -154,18 +155,21 @@ public class UserInfoLabel extends UILabel {
return; return;
} }
String res = hc.getResponseText(); String res = hc.getResponseText();
if (res.indexOf(BBSConstants.UPDATE_KEY) == -1) { if (!res.contains(BBSConstants.UPDATE_KEY)) {
return; return;
} }
try { try {
BBSDialog bbsLabel = new BBSDialog(DesignerContext.getDesignerFrame()); Class<?> clazz = Class.forName("com.fr.design.mainframe.bbs.BBSDialog");
bbsLabel.showWindow(SiteCenter.getInstance().acquireUrlByKind("bbs.popup")); Constructor constructor = clazz.getConstructor(Frame.class);
Object instance = constructor.newInstance(DesignerContext.getDesignerFrame());
Method showWindow = clazz.getMethod("showWindow", String.class);
showWindow.invoke(instance, SiteCenter.getInstance().acquireUrlByKind("bbs.popup"));
DesignerEnvManager.getEnvManager().setLastShowBBSNewsTime(DateUtils.DATEFORMAT2.format(new Date())); DesignerEnvManager.getEnvManager().setLastShowBBSNewsTime(DateUtils.DATEFORMAT2.format(new Date()));
} catch (Throwable e) { } catch (Throwable ignored) {
// ignored
} }
} }
}); });
showBBSThread.start();
} }
private void sleep(long millis) { private void sleep(long millis) {
@ -192,8 +196,6 @@ public class UserInfoLabel extends UILabel {
return; return;
} }
//往designerenvmanger里写一下
DesignerEnvManager.getEnvManager().setBBSName(userName);
this.userName = userName; this.userName = userName;
} }
@ -220,26 +222,25 @@ public class UserInfoLabel extends UILabel {
} }
this.messageCount = messageCount; this.messageCount = messageCount;
StringBuilder sb = new StringBuilder(); String sb = StringUtils.BLANK + this.userName +
"(" + this.messageCount +
")" + StringUtils.BLANK;
//内容eg: aaa(11) //内容eg: aaa(11)
sb.append(StringUtils.BLANK).append(this.userName)
.append("(").append(this.messageCount)
.append(")").append(StringUtils.BLANK);
//更新面板Text //更新面板Text
this.setText(sb.toString()); this.setText(sb);
} }
private MouseAdapter userInfoAdapter = new MouseAdapter() { private MouseAdapter userInfoAdapter = new MouseAdapter() {
@Override
public void mouseEntered(MouseEvent e) { public void mouseEntered(MouseEvent e) {
UserInfoLabel.this.setCursor(new Cursor(Cursor.HAND_CURSOR)); UserInfoLabel.this.setCursor(new Cursor(Cursor.HAND_CURSOR));
} }
@Override @Override
public void mouseClicked(MouseEvent e) { public void mouseClicked(MouseEvent e) {
BBSUserInfo bbsUserInfo = BBSPluginLogin.getInstance().getUserInfo(); userName = ConfigManager.getProviderInstance().getBbsUsername();
userName = bbsUserInfo == null ? "" : bbsUserInfo.getUserName();
if (StringUtils.isNotEmpty(userName)) { if (StringUtils.isNotEmpty(userName)) {
UIPopupMenu menu = new UIPopupMenu(); UIPopupMenu menu = new UIPopupMenu();
menu.setOnlyText(true); menu.setOnlyText(true);
@ -248,6 +249,7 @@ public class UserInfoLabel extends UILabel {
//私人消息 //私人消息
UIMenuItem priviteMessage = new UIMenuItem(Inter.getLocText("FR-Designer-BBSLogin_Privite-Message")); UIMenuItem priviteMessage = new UIMenuItem(Inter.getLocText("FR-Designer-BBSLogin_Privite-Message"));
priviteMessage.addMouseListener(new MouseAdapter() { priviteMessage.addMouseListener(new MouseAdapter() {
@Override
public void mousePressed(MouseEvent e) { public void mousePressed(MouseEvent e) {
if (StringUtils.isNotEmpty(userName)) { if (StringUtils.isNotEmpty(userName)) {
try { try {
@ -256,7 +258,6 @@ public class UserInfoLabel extends UILabel {
} catch (Exception exp) { } catch (Exception exp) {
FRContext.getLogger().info(exp.getMessage()); FRContext.getLogger().info(exp.getMessage());
} }
return;
} }
} }
@ -264,11 +265,11 @@ public class UserInfoLabel extends UILabel {
//切换账号 //切换账号
UIMenuItem closeOther = new UIMenuItem(Inter.getLocText("FR-Designer-BBSLogin_Switch-Account")); UIMenuItem closeOther = new UIMenuItem(Inter.getLocText("FR-Designer-BBSLogin_Switch-Account"));
closeOther.addMouseListener(new MouseAdapter() { closeOther.addMouseListener(new MouseAdapter() {
@Override
public void mousePressed(MouseEvent e) { public void mousePressed(MouseEvent e) {
BBSPluginLogin.getInstance().logOut(); BBSLoginUtils.bbsLogout();
UserLoginContext.fireLoginContextListener(); UserLoginContext.fireLoginContextListener();
} }
}); });
menu.add(priviteMessage); menu.add(priviteMessage);
menu.add(closeOther); menu.add(closeOther);

46
designer/src/com/fr/design/mainframe/bbs/UserInfoPane.java

@ -3,25 +3,27 @@
*/ */
package com.fr.design.mainframe.bbs; package com.fr.design.mainframe.bbs;
import java.awt.BorderLayout; import com.fr.base.ConfigManager;
import java.awt.Color;
import java.awt.Dimension;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.constants.UIConstants;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.general.DateUtils; import com.fr.general.DateUtils;
import com.fr.general.FRLogger; import com.fr.general.FRLogger;
import com.fr.general.GeneralContext;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.plugin.manage.bbs.BBSPluginLogin; import com.fr.stable.EnvChangedListener;
import com.fr.plugin.manage.bbs.BBSUserInfo;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
/** /**
* @author neil * @author neil
@ -31,7 +33,7 @@ import com.fr.stable.StringUtils;
public class UserInfoPane extends BasicPane{ public class UserInfoPane extends BasicPane{
//默认未登录颜色 //默认未登录颜色
private static final Color UN_LOGIN_BACKGROUND = new Color(210, 210, 210); private static final Color UN_LOGIN_BACKGROUND = UIConstants.TEMPLATE_TAB_PANE_BACKGROUND;
private static final Color LOGIN_BACKGROUND = new Color(184, 220, 242); private static final Color LOGIN_BACKGROUND = new Color(184, 220, 242);
private static final int WIDTH = 104; private static final int WIDTH = 104;
private static final int HEIGHT = 24; private static final int HEIGHT = 24;
@ -46,6 +48,7 @@ public class UserInfoPane extends BasicPane{
private UserInfoLabel userInfoLabel; private UserInfoLabel userInfoLabel;
public UserInfoLabel getUserInfoLabel() { public UserInfoLabel getUserInfoLabel() {
return userInfoLabel; return userInfoLabel;
} }
@ -65,30 +68,27 @@ public class UserInfoPane extends BasicPane{
this.userInfoLabel = new UserInfoLabel(this); this.userInfoLabel = new UserInfoLabel(this);
this.markUnSignIn(); this.markUnSignIn();
autoLogin(); addEnvChangedListener();
autoPushLoginDialog(); autoPushLoginDialog();
this.add(userInfoLabel, BorderLayout.CENTER); this.add(userInfoLabel, BorderLayout.CENTER);
} }
// 后台自动登录 private void addEnvChangedListener(){
private void autoLogin(){ GeneralContext.addEnvChangedListener(new EnvChangedListener() {
Thread bbsAutoLoginThread = new Thread(new Runnable() {
@Override @Override
public void run() { public void envChanged() {
String username = DesignerEnvManager.getEnvManager().getBBSName(); String username = ConfigManager.getProviderInstance().getBbsUsername();
String inShowUsername = DesignerEnvManager.getEnvManager().getInShowBBsName(); if (StringUtils.isEmpty(username)){
if (StringUtils.isEmpty(username) && StringUtils.isEmpty(inShowUsername)){
markUnSignIn(); markUnSignIn();
} else { } else {
markSignIn(username); markSignIn(username);
} }
} }
}); });
bbsAutoLoginThread.start();
} }
// 计算xml保存的上次弹框时间和当前时间的时间差 // 计算xml保存的上次弹框时间和当前时间的时间差
private int getDiffFromLastLogin(){ private int getDiffFromLastLogin(){
String lastBBSTime = DesignerEnvManager.getEnvManager().getLastShowBBSTime(); String lastBBSTime = DesignerEnvManager.getEnvManager().getLastShowBBSTime();
@ -133,7 +133,7 @@ public class UserInfoPane extends BasicPane{
FRContext.getLogger().error(e.getMessage()); FRContext.getLogger().error(e.getMessage());
} }
String userName = DesignerEnvManager.getEnvManager().getBBSName(); String userName = ConfigManager.getProviderInstance().getBbsUsername();
if(StringUtils.isNotEmpty(userName)){ if(StringUtils.isNotEmpty(userName)){
return; return;
} }
@ -169,8 +169,6 @@ public class UserInfoPane extends BasicPane{
* *
*/ */
public void markSignIn(String userName){ public void markSignIn(String userName){
String password = DesignerEnvManager.getEnvManager().getBBSPassword();
BBSPluginLogin.getInstance().login(new BBSUserInfo(userName, password));
this.userInfoLabel.setText(userName); this.userInfoLabel.setText(userName);
this.userInfoLabel.setUserName(userName); this.userInfoLabel.setUserName(userName);
this.userInfoLabel.setOpaque(true); this.userInfoLabel.setOpaque(true);

12
designer/src/com/fr/design/mainframe/bbs/bbs.properties

@ -4,16 +4,8 @@ COLLECT_URL=http://www.finereporthelp.com:8081/bbs/ReportServer?op=bbs&cmd=colle
DEFAULT_URL=http\://bbs.finereport.com/home.php?mod=space&do=notice DEFAULT_URL=http\://bbs.finereport.com/home.php?mod=space&do=notice
GET_MESSAGE_URL=http://feedback.finedevelop.com:3000/bbs/message/count GET_MESSAGE_URL=http://feedback.finedevelop.com:3000/bbs/message/count
GET_SIGN_INFO_URL=http\://bbs.finereport.com GET_SIGN_INFO_URL=http\://bbs.finereport.com
LINK0=http\://bbs.finereport.com/space-uid-55823.html LINK=http\://bbs.fanruan.com/home.php?mod=space&uid=66470&do=profile|http\://bbs.fanruan.com/home.php?mod=space&uid=67190&do=profile|http\://bbs.fanruan.com/home.php?mod=space&uid=65659&do=profile|http\://bbs.fanruan.com/home.php?mod=space&uid=60352&do=profile|http\://bbs.fanruan.com/home.php?mod=space&uid=78157&do=profile
LINK1=http\://bbs.finereport.com/space-uid-56940.html
LINK2=http\://bbs.finereport.com/space-uid-51621.html
LINK3=http\://bbs.finereport.com/space-uid-52618.html
LINK4=http\://bbs.finereport.com/space-uid-48993.html
SHARE_URL=http\://bbs.finereport.com SHARE_URL=http\://bbs.finereport.com
USER0=\u6590\u6CE2\u90A3\u5951(\u5B59\u70B3\u6DA6) USER=cherishdqy\uFF08\u9093\u79CB\u4E91\uFF09|yets11\uFF08\u9676\u5B5D\u6587\uFF09|\u661F\u75D5\uFF08\u71D5\u5B8F\u4F1F\uFF09|\u9759\u542C\u7985\u9E23\uFF08\u674E\u51A0\u519B\uFF09|yiyemeiying\uFF08\u5218\u4F73\uFF09
USER1=deafire(\u674E\u5FD7\u4F1F)
USER2=\u963F\u8FEA(\u8C22\u8FEA)
USER3=bingjie(\u5F20\u8BB0\u82B1)
USER4=\u6D77\u7EF5\u5B9D\u5B9D(\u90DD\u6B63)
VERIFY_URL=http://www.finereporthelp.com:8081/bbs/ReportServer?op=bbs&cmd=verify VERIFY_URL=http://www.finereporthelp.com:8081/bbs/ReportServer?op=bbs&cmd=verify
UPDATE_INFO_URL=http://bbs.finereport.com/source/plugin/infor/infor.html UPDATE_INFO_URL=http://bbs.finereport.com/source/plugin/infor/infor.html

123
designer/src/com/fr/design/mainframe/cell/AbstractDSCellEditorPane.java

@ -0,0 +1,123 @@
package com.fr.design.mainframe.cell;
import com.fr.design.gui.iscrollbar.UIScrollBar;
import com.fr.design.mainframe.CellElementPropertyPane;
import com.fr.quickeditor.cellquick.layout.CellElementBarLayout;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.event.AdjustmentEvent;
import java.awt.event.AdjustmentListener;
import java.awt.event.MouseWheelEvent;
import java.awt.event.MouseWheelListener;
/**
* 右侧单元格元素面板抽象类
*
* @author yaoh.wu
* @version 2017年7月25日
* @since 9.0
*/
public abstract class AbstractDSCellEditorPane extends JPanel {
/**
* 滚动条相关配置
*/
private static final int MAXVALUE = 100;
private static final int TITLE_HEIGHT = 95;
private static final int CONTENT_PANE_WIDTH_GAP = 3;
private static final int SCROLLBAR_WIDTH = 7;
private static final int MOUSE_WHEEL_SPEED = 5;
private int maxHeight = 280;
private JPanel leftContentPane;
private UIScrollBar scrollBar;
protected abstract JPanel createContentPane();
public abstract String getIconPath();
public abstract String title4PopupWindow();
/**
* 从面板拿数据保存
*/
public abstract void update();
/**
* 更新面板数据
*/
public abstract void populate();
protected void createScrollPane() {
leftContentPane = this.createContentPane();
this.prepareScrollBar();
leftContentPane.setBorder(BorderFactory.createMatteBorder(10, 10, 0, 0, this.getBackground()));
this.setLayout(new CellElementBarLayout(leftContentPane) {
@Override
public void layoutContainer(Container parent) {
maxHeight = CellElementPropertyPane.getInstance().getHeight() - TITLE_HEIGHT;
int beginY;
if ((MAXVALUE - scrollBar.getVisibleAmount()) == 0) {
beginY = 0;
} else {
int preferredHeight = leftContentPane.getPreferredSize().height;
int value = scrollBar.getValue();
beginY = value * (preferredHeight - maxHeight) / (MAXVALUE - scrollBar.getVisibleAmount());
}
int width = parent.getWidth();
int height = parent.getHeight();
if (leftContentPane.getPreferredSize().height > maxHeight) {
leftContentPane.setBounds(0, -beginY, width - SCROLLBAR_WIDTH - CONTENT_PANE_WIDTH_GAP, height + beginY);
scrollBar.setBounds(width - SCROLLBAR_WIDTH - CONTENT_PANE_WIDTH_GAP, 0, SCROLLBAR_WIDTH + CONTENT_PANE_WIDTH_GAP, height);
} else {
leftContentPane.setBounds(0, 0, width - SCROLLBAR_WIDTH - CONTENT_PANE_WIDTH_GAP, height);
}
}
});
this.add(scrollBar);
this.add(leftContentPane);
}
private void prepareScrollBar() {
scrollBar = new UIScrollBar(UIScrollBar.VERTICAL) {
@Override
public int getVisibleAmount() {
int preferredHeight = leftContentPane.getPreferredSize().height;
int e = MAXVALUE * (maxHeight) / preferredHeight;
setVisibleAmount(e);
return e;
}
@Override
public int getMaximum() {
return MAXVALUE;
}
};
scrollBar.addAdjustmentListener(new AdjustmentListener() {
@Override
public void adjustmentValueChanged(AdjustmentEvent e) {
doLayout();
}
});
this.addMouseWheelListener(new MouseWheelListener() {
@Override
public void mouseWheelMoved(MouseWheelEvent e) {
int value = scrollBar.getValue();
value += MOUSE_WHEEL_SPEED * e.getWheelRotation();
scrollBar.setValue(value);
doLayout();
}
});
scrollBar.setPreferredSize(new Dimension(SCROLLBAR_WIDTH + CONTENT_PANE_WIDTH_GAP, this.getHeight()));
scrollBar.setBlockIncrement(SCROLLBAR_WIDTH + CONTENT_PANE_WIDTH_GAP);
scrollBar.setBorder(BorderFactory.createMatteBorder(0, CONTENT_PANE_WIDTH_GAP, 0, 0, this.getBackground()));
}
}

28
designer/src/com/fr/design/mainframe/cell/CellEditorPane.java

@ -1,28 +0,0 @@
package com.fr.design.mainframe.cell;
import com.fr.design.dialog.BasicPane;
/**
* 右侧单元格元素面板抽象类
*
* @author yaoh.wu
* @version 2017年7月25日
* @since 9.0
*/
public abstract class CellEditorPane extends BasicPane {
public abstract String getIconPath();
public abstract String title4PopupWindow();
/**
* 从面板拿数据保存
*/
public abstract void update();
/**
* 更新面板数据
*
*/
public abstract void populate();
}

19
designer/src/com/fr/design/mainframe/cell/CellElementEditPane.java

@ -32,35 +32,22 @@ import java.util.List;
* @since 2012-5-8下午12:18:53 * @since 2012-5-8下午12:18:53
*/ */
public class CellElementEditPane extends BasicPane { public class CellElementEditPane extends BasicPane {
private static int TIME_GAP = 80; private static final int LEFT_BORDER = -5;
private static final int RIGHT_BORDER = 5;
private List<AbstractCellAttrPane> paneList; private List<AbstractCellAttrPane> paneList;
private TemplateCellElement cellelement; private TemplateCellElement cellelement;
private ElementCasePane ePane; private ElementCasePane ePane;
private UIHeadGroup tabsHeaderIconPane; private UIHeadGroup tabsHeaderIconPane;
private boolean isEditing; private boolean isEditing;
private int PaneListIndex;
private CardLayout card; private CardLayout card;
private JPanel center; private JPanel center;
private JPanel downTitle; private JPanel downTitle;
private JPanel title;
private UILabel titlename;
private TitleChangeListener titleChangeListener = null; private TitleChangeListener titleChangeListener = null;
private CellAttributeProvider cellAttributeProvider = null; private CellAttributeProvider cellAttributeProvider = null;
public static void main(String[] args){
JFrame jf = new JFrame("test");
jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JPanel content = (JPanel) jf.getContentPane();
content.setLayout(new BorderLayout());
content.add(new CellElementEditPane(), BorderLayout.CENTER);
GUICoreUtils.centerWindow(jf);
jf.setSize(290, 400);
jf.setVisible(true);
}
public CellElementEditPane() { public CellElementEditPane() {
setLayout(new BorderLayout()); setLayout(new BorderLayout());
initPaneList(); initPaneList();
@ -89,7 +76,7 @@ public class CellElementEditPane extends BasicPane {
downTitle = new JPanel(); downTitle = new JPanel();
downTitle.setLayout(new BorderLayout()); downTitle.setLayout(new BorderLayout());
downTitle.add(tabsHeaderIconPane, BorderLayout.NORTH); downTitle.add(tabsHeaderIconPane, BorderLayout.NORTH);
center.setBorder(BorderFactory.createEmptyBorder(0, -10, 0, -10)); center.setBorder(BorderFactory.createEmptyBorder(0, LEFT_BORDER, 0, 0));
downTitle.add(center, BorderLayout.CENTER); downTitle.add(center, BorderLayout.CENTER);
this.add(downTitle, BorderLayout.CENTER); this.add(downTitle, BorderLayout.CENTER);

36
designer/src/com/fr/design/mainframe/cell/settingpane/CellExpandAttrPane.java

@ -2,6 +2,7 @@ package com.fr.design.mainframe.cell.settingpane;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.design.constants.LayoutConstants; import com.fr.design.constants.LayoutConstants;
import com.fr.design.constants.UIConstants;
import com.fr.design.expand.ExpandLeftFatherPane; import com.fr.design.expand.ExpandLeftFatherPane;
import com.fr.design.expand.ExpandUpFatherPane; import com.fr.design.expand.ExpandUpFatherPane;
import com.fr.design.expand.SortExpandAttrPane; import com.fr.design.expand.SortExpandAttrPane;
@ -44,10 +45,10 @@ public class CellExpandAttrPane extends AbstractCellAttrPane {
*/ */
public JPanel createContentPane() { public JPanel createContentPane() {
String[] nameArray = {Inter.getLocText("ExpandD-Not_Expand"), Inter.getLocText("Utils-Top_to_Bottom"), Inter.getLocText("Utils-Left_to_Right")}; String[] nameArray = {Inter.getLocText("ExpandD-Not_Expand"), Inter.getLocText("Utils-Top_to_Bottom"), Inter.getLocText("Utils-Left_to_Right")};
Icon[] iconArray = { Icon[][] iconArray = {
BaseUtils.readIcon("/com/fr/design/images/expand/none16x16.png"), {BaseUtils.readIcon("/com/fr/design/images/expand/none16x16.png"), BaseUtils.readIcon("/com/fr/design/images/expand/none16x16_selected@1x.png")},
BaseUtils.readIcon("/com/fr/design/images/expand/vertical.png"), {BaseUtils.readIcon("/com/fr/design/images/expand/vertical.png"), BaseUtils.readIcon("/com/fr/design/images/expand/vertical_selected@1x.png")},
BaseUtils.readIcon("/com/fr/design/images/expand/landspace.png") {BaseUtils.readIcon("/com/fr/design/images/expand/landspace.png"), BaseUtils.readIcon("/com/fr/design/images/expand/landspace_selected@1x.png")}
}; };
Byte[] valueArray = {Constants.NONE, Constants.TOP_TO_BOTTOM, Constants.LEFT_TO_RIGHT}; Byte[] valueArray = {Constants.NONE, Constants.TOP_TO_BOTTOM, Constants.LEFT_TO_RIGHT};
expandDirectionButton = new UIButtonGroup<Byte>(iconArray, valueArray); expandDirectionButton = new UIButtonGroup<Byte>(iconArray, valueArray);
@ -61,18 +62,6 @@ public class CellExpandAttrPane extends AbstractCellAttrPane {
return layoutPane(); return layoutPane();
} }
public static void main(String[] args) {
JFrame jf = new JFrame("test");
jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JPanel content = (JPanel) jf.getContentPane();
content.setLayout(new BorderLayout());
content.add(new CellExpandAttrPane().layoutPane(), BorderLayout.CENTER);
GUICoreUtils.centerWindow(jf);
jf.setSize(290, 400);
jf.setVisible(true);
}
private void initAllNames() { private void initAllNames() {
expandDirectionButton.setGlobalName(Inter.getLocText("FR-Designer_ExpandD_Expand_Direction")); expandDirectionButton.setGlobalName(Inter.getLocText("FR-Designer_ExpandD_Expand_Direction"));
leftFatherPane.setGlobalName(Inter.getLocText("FR-Designer_LeftParent")); leftFatherPane.setGlobalName(Inter.getLocText("FR-Designer_LeftParent"));
@ -85,8 +74,8 @@ public class CellExpandAttrPane extends AbstractCellAttrPane {
layoutPane = new JPanel(new BorderLayout()); layoutPane = new JPanel(new BorderLayout());
basicPane = new JPanel(); basicPane = new JPanel();
seniorPane = new JPanel(); seniorPane = new JPanel();
basicPane = new UIExpandablePane(Inter.getLocText("FR-Designer_Basic"), 290, 24, basicPane()); basicPane = new UIExpandablePane(Inter.getLocText("FR-Designer_Basic"), 223, 24, basicPane());
seniorPane = new UIExpandablePane(Inter.getLocText("FR-Designer_Advanced"), 290, 24, seniorPane()); seniorPane = new UIExpandablePane(Inter.getLocText("FR-Designer_Advanced"), 223, 24, seniorPane());
layoutPane.add(basicPane, BorderLayout.NORTH); layoutPane.add(basicPane, BorderLayout.NORTH);
layoutPane.add(seniorPane, BorderLayout.CENTER); layoutPane.add(seniorPane, BorderLayout.CENTER);
return layoutPane; return layoutPane;
@ -96,8 +85,8 @@ public class CellExpandAttrPane extends AbstractCellAttrPane {
double f = TableLayout.FILL; double f = TableLayout.FILL;
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
UILabel direction = new UILabel(Inter.getLocText("FR-Designer_ExpandD_Expand_Direction"), SwingConstants.LEFT); UILabel direction = new UILabel(Inter.getLocText("FR-Designer_ExpandD_Expand_Direction"), SwingConstants.LEFT);
// JPanel directionPane = new JPanel(new BorderLayout()); JPanel directionPane = new JPanel(new BorderLayout());
// directionPane.add(direction, BorderLayout.NORTH); directionPane.add(direction, BorderLayout.NORTH);
UILabel left = new UILabel(Inter.getLocText("FR-Designer_LeftParent"), SwingConstants.LEFT); UILabel left = new UILabel(Inter.getLocText("FR-Designer_LeftParent"), SwingConstants.LEFT);
JPanel leftPane = new JPanel(new BorderLayout()); JPanel leftPane = new JPanel(new BorderLayout());
leftPane.add(left, BorderLayout.NORTH); leftPane.add(left, BorderLayout.NORTH);
@ -106,7 +95,7 @@ public class CellExpandAttrPane extends AbstractCellAttrPane {
upPane.add(up, BorderLayout.NORTH); upPane.add(up, BorderLayout.NORTH);
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{null, null}, new Component[]{null, null},
new Component[]{direction, expandDirectionButton}, new Component[]{directionPane, expandDirectionButton},
new Component[]{leftPane, leftFatherPane}, new Component[]{leftPane, leftFatherPane},
new Component[]{upPane, rightFatherPane}, new Component[]{upPane, rightFatherPane},
}; };
@ -122,6 +111,8 @@ public class CellExpandAttrPane extends AbstractCellAttrPane {
UILabel expendSort = new UILabel(Inter.getLocText("FR-Designer_ExpendSort"), SwingConstants.LEFT); UILabel expendSort = new UILabel(Inter.getLocText("FR-Designer_ExpendSort"), SwingConstants.LEFT);
JPanel expendSortPane = new JPanel(new BorderLayout()); JPanel expendSortPane = new JPanel(new BorderLayout());
expendSortPane.add(expendSort, BorderLayout.NORTH); expendSortPane.add(expendSort, BorderLayout.NORTH);
horizontalExpandableCheckBox.setBorder(UIConstants.CELL_ATTR_ZEROBORDER);
verticalExpandableCheckBox.setBorder(UIConstants.CELL_ATTR_ZEROBORDER);
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{null, null}, new Component[]{null, null},
new Component[]{horizontalExpandableCheckBox, null}, new Component[]{horizontalExpandableCheckBox, null},
@ -163,6 +154,7 @@ public class CellExpandAttrPane extends AbstractCellAttrPane {
default: { default: {
horizontalExpandableCheckBox.setSelected(false); horizontalExpandableCheckBox.setSelected(false);
verticalExpandableCheckBox.setSelected(false); verticalExpandableCheckBox.setSelected(false);
break;
} }
} }
@ -196,7 +188,7 @@ public class CellExpandAttrPane extends AbstractCellAttrPane {
// extendable // extendable
if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_ExpandD-Expandable"))) { if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_ExpandD_Expandable"))) {
if (horizontalExpandableCheckBox.isSelected()) { if (horizontalExpandableCheckBox.isSelected()) {
if (verticalExpandableCheckBox.isSelected()) { if (verticalExpandableCheckBox.isSelected()) {
cellExpandAttr.setExtendable(CellExpandAttr.Both_EXTENDABLE); cellExpandAttr.setExtendable(CellExpandAttr.Both_EXTENDABLE);

72
designer/src/com/fr/design/mainframe/cell/settingpane/CellOtherSetPane.java

@ -1,6 +1,7 @@
package com.fr.design.mainframe.cell.settingpane; package com.fr.design.mainframe.cell.settingpane;
import com.fr.design.constants.LayoutConstants; import com.fr.design.constants.LayoutConstants;
import com.fr.design.constants.UIConstants;
import com.fr.design.editor.ValueEditorPane; import com.fr.design.editor.ValueEditorPane;
import com.fr.design.editor.ValueEditorPaneFactory; import com.fr.design.editor.ValueEditorPaneFactory;
import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.HistoryTemplateListPane;
@ -10,6 +11,7 @@ import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.icombobox.UIComboBox; 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.FRGUIPaneFactory;
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.JTemplate; import com.fr.design.mainframe.JTemplate;
@ -21,6 +23,7 @@ import com.fr.report.cell.cellattr.CellGUIAttr;
import com.fr.report.cell.cellattr.CellInsertPolicyAttr; import com.fr.report.cell.cellattr.CellInsertPolicyAttr;
import com.fr.report.cell.cellattr.CellPageAttr; import com.fr.report.cell.cellattr.CellPageAttr;
import com.fr.report.elementcase.TemplateElementCase; import com.fr.report.elementcase.TemplateElementCase;
import com.fr.stable.StringUtils;
import javax.swing.*; import javax.swing.*;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
@ -37,6 +40,8 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
private static final int HEAD_WDITH = 290; private static final int HEAD_WDITH = 290;
private static final int HEAD_HEIGTH = 24; private static final int HEAD_HEIGTH = 24;
private static final Dimension NORMAL_DIMENSION = new Dimension(155, 20);
private static final Dimension SMALL_DIMENSION = new Dimension(150, 20);
// normal // normal
private UIButtonGroup autoshrik; private UIButtonGroup autoshrik;
@ -77,7 +82,7 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
JPanel downPane = new JPanel(new BorderLayout()); JPanel downPane = new JPanel(new BorderLayout());
downPane.add(new UIExpandablePane(Inter.getLocText("FR-Designer_Advanced"), HEAD_WDITH, HEAD_HEIGTH, seniorPane()), BorderLayout.NORTH); downPane.add(new UIExpandablePane(Inter.getLocText("FR-Designer_Advanced"), HEAD_WDITH, HEAD_HEIGTH, seniorPane()), BorderLayout.NORTH);
downPane.add(new UIExpandablePane(Inter.getLocText("FR-Designer_Pagination"), HEAD_WDITH, HEAD_HEIGTH, pagePane()), BorderLayout.CENTER); downPane.add(new UIExpandablePane(Inter.getLocText("FR-Designer_Pagination"), HEAD_WDITH, HEAD_HEIGTH, pagePane()), BorderLayout.CENTER);
JPanel contentPane = new JPanel(new BorderLayout(0, 10)); JPanel contentPane = new JPanel(new BorderLayout(0, 0));
contentPane.add(new UIExpandablePane(Inter.getLocText("FR-Designer_Basic"), HEAD_WDITH, HEAD_HEIGTH, basicPane()), BorderLayout.NORTH); contentPane.add(new UIExpandablePane(Inter.getLocText("FR-Designer_Basic"), HEAD_WDITH, HEAD_HEIGTH, basicPane()), BorderLayout.NORTH);
contentPane.add(downPane, BorderLayout.CENTER); contentPane.add(downPane, BorderLayout.CENTER);
initAllNames(); initAllNames();
@ -88,18 +93,19 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
private JPanel basicPane() { private JPanel basicPane() {
autoHeightCheckBox = new UICheckBox(Inter.getLocText("FR-Designer_Auto_Adjust_Height")); autoHeightCheckBox = new UICheckBox(Inter.getLocText("FR-Designer_Auto_Adjust_Height"));
autoWidthCheckBox = new UICheckBox(Inter.getLocText("FR-Designer_Auto_Adjust_Wdith")); autoWidthCheckBox = new UICheckBox(Inter.getLocText("FR-Designer_Auto_Adjust_Wdith"));
autoHeightCheckBox.setBorder(UIConstants.CELL_ATTR_ZEROBORDER);
autoWidthCheckBox.setBorder(UIConstants.CELL_ATTR_ZEROBORDER);
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double[] rowSize = {p, p, p, p, p}; double[] rowSize = {p, p, p, p};
double[] columnSize = {p}; double[] columnSize = {p};
int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}}; int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}};
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{null}, new Component[]{null},
new Component[]{autoHeightCheckBox}, new Component[]{autoHeightCheckBox},
new Component[]{null},
new Component[]{autoWidthCheckBox}, new Component[]{autoWidthCheckBox},
new Component[]{null}, new Component[]{null},
}; };
return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_MEDIUM, LayoutConstants.VGAP_MEDIUM); return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_MEDIUM, LayoutConstants.VGAP_LARGE);
} }
@ -136,7 +142,7 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
new Component[]{new UILabel(Inter.getLocText("FR-Designer_CellWrite_InsertRow_Policy"), SwingConstants.LEFT), insertRowPolicy}, new Component[]{new UILabel(Inter.getLocText("FR-Designer_CellWrite_InsertRow_Policy"), SwingConstants.LEFT), insertRowPolicy},
new Component[]{null, insertRowPane}, new Component[]{null, insertRowPane},
}; };
southContentPane = TableLayoutHelper.createGapTableLayoutPane(components1, rowSize1, columnSize1, rowCount1, LayoutConstants.VGAP_MEDIUM, LayoutConstants.VGAP_MEDIUM); southContentPane = TableLayoutHelper.createGapTableLayoutPane(components1, rowSize1, columnSize1, rowCount1, LayoutConstants.VGAP_LARGE, LayoutConstants.VGAP_MEDIUM);
JPanel seniorPane = new JPanel(new BorderLayout()); JPanel seniorPane = new JPanel(new BorderLayout());
seniorPane.add(seniorUpPane(), BorderLayout.NORTH); seniorPane.add(seniorUpPane(), BorderLayout.NORTH);
seniorPane.add(southContentPane, BorderLayout.CENTER); seniorPane.add(southContentPane, BorderLayout.CENTER);
@ -146,22 +152,48 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
private JPanel seniorUpPane() { private JPanel seniorUpPane() {
JPanel fileNamePane = createNormal(); JPanel fileNamePane = createNormal();
previewCellContent.setBorder(UIConstants.CELL_ATTR_ZEROBORDER);
printAndExportContent.setBorder(UIConstants.CELL_ATTR_ZEROBORDER);
printAndExportBackground.setBorder(UIConstants.CELL_ATTR_ZEROBORDER);
double f = TableLayout.FILL; double f = TableLayout.FILL;
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double[] rowSize = {p, p, p, p, p, p, p, p, p}; double[] rowSize = {p, p, p, p};
double[] columnSize = {p, f}; double[] columnSize = {p, f};
int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}}; int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}};
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{null, null}, new Component[]{null, null},
new Component[]{previewCellContent, null}, new Component[]{previewCellContent, null},
new Component[]{printAndExportContent, null}, new Component[]{printAndExportContent, null},
new Component[]{printAndExportBackground, null}, new Component[]{printAndExportBackground, null},
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Show_Content"), SwingConstants.LEFT), showContent}, };
new Component[]{null, fileNamePane}, JPanel upPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_MEDIUM, LayoutConstants.VGAP_LARGE);
new Component[]{new UILabel(Inter.getLocText("FR-Designer_CellWrite_ToolTip"), SwingConstants.RIGHT), tooltipTextField},
double[] downRowSize = {p, p, p, p, p, p};
double[] downColumnSize = {p, f};
int[][] downRowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}};
JPanel showContentPane = new JPanel(FRGUIPaneFactory.createRightZeroLayout());
showContent.setPreferredSize(SMALL_DIMENSION);
showContentPane.add(showContent);
fileNamePane.setBorder(BorderFactory.createEmptyBorder(0,12,0,0));
JPanel tooltipTextFieldPane = new JPanel(FRGUIPaneFactory.createRightZeroLayout());
tooltipTextField.setPreferredSize(NORMAL_DIMENSION);
tooltipTextFieldPane.add(tooltipTextField);
Component[][] downComponent = new Component[][]{
new Component[]{null, null},
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Show_Content"), SwingConstants.LEFT), showContentPane},
new Component[]{fileNamePane, null},
new Component[]{new UILabel(Inter.getLocText("FR-Designer_CellWrite_ToolTip"), SwingConstants.LEFT), tooltipTextFieldPane},
new Component[]{null, null},
new Component[]{null, null}, new Component[]{null, null},
}; };
return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_MEDIUM, LayoutConstants.VGAP_MEDIUM); JPanel downPane = TableLayoutHelper.createGapTableLayoutPane(downComponent, downRowSize, downColumnSize, downRowCount, LayoutConstants.VGAP_LARGE, LayoutConstants.VGAP_MEDIUM);
JPanel pane = new JPanel(new BorderLayout());
pane.add(upPane, BorderLayout.NORTH);
pane.add(downPane, BorderLayout.CENTER);
return pane;
} }
private JPanel pagePane() { private JPanel pagePane() {
@ -175,6 +207,13 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
canBreakOnPaginateCheckBox = new UICheckBox(Inter.getLocText("FR-Designer_CellPage_Can_Break_On_Paginate")); canBreakOnPaginateCheckBox = new UICheckBox(Inter.getLocText("FR-Designer_CellPage_Can_Break_On_Paginate"));
repeatCheckBox = new UICheckBox(Inter.getLocText("FR-Designer_CellPage_Repeat_Content_When_Paging")); repeatCheckBox = new UICheckBox(Inter.getLocText("FR-Designer_CellPage_Repeat_Content_When_Paging"));
pageBeforeRowCheckBox.setBorder(UIConstants.CELL_ATTR_ZEROBORDER);
pageAfterRowCheckBox.setBorder(UIConstants.CELL_ATTR_ZEROBORDER);
pageBeforeColumnCheckBox.setBorder(UIConstants.CELL_ATTR_ZEROBORDER);
pageAfterColumnCheckBox.setBorder(UIConstants.CELL_ATTR_ZEROBORDER);
canBreakOnPaginateCheckBox.setBorder(UIConstants.CELL_ATTR_ZEROBORDER);
repeatCheckBox.setBorder(UIConstants.CELL_ATTR_ZEROBORDER);
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double[] rowSize = {p, p, p, p, p, p, p, p, p, p, p}; double[] rowSize = {p, p, p, p, p, p, p, p, p, p, p};
double[] columnSize = {p}; double[] columnSize = {p};
@ -190,7 +229,7 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
new Component[]{canBreakOnPaginateCheckBox}, new Component[]{canBreakOnPaginateCheckBox},
new Component[]{repeatCheckBox}, new Component[]{repeatCheckBox},
}; };
return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_MEDIUM, LayoutConstants.VGAP_MEDIUM); return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_MEDIUM, LayoutConstants.VGAP_LARGE);
} }
@ -224,8 +263,6 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
} }
} }
}); });
tooltipTextField = new UITextField();
tooltipTextField.getUI();
return fileNamePane; return fileNamePane;
} }
@ -320,6 +357,7 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
this.valueEditor.populate(defaultValue); this.valueEditor.populate(defaultValue);
} else { } else {
insertRowPolicy.setSelectedIndex(0); insertRowPolicy.setSelectedIndex(0);
this.valueEditor.populate(StringUtils.EMPTY);
} }
if (insertRowPolicy.getSelectedIndex() == 1) { if (insertRowPolicy.getSelectedIndex() == 1) {
insertRowPane.setPreferredSize(new Dimension(100, 20)); insertRowPane.setPreferredSize(new Dimension(100, 20));
@ -428,10 +466,10 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_CellWrite_Page_After_Column"))) { if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_CellWrite_Page_After_Column"))) {
cellPageAttr.setPageAfterColumn(this.pageAfterColumnCheckBox.isSelected()); cellPageAttr.setPageAfterColumn(this.pageAfterColumnCheckBox.isSelected());
} }
if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_CellWrite_Can_Break_On_Paginate"))) { if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_CellPage_Can_Break_On_Paginate"))) {
cellPageAttr.setCanBreakOnPaginate(canBreakOnPaginateCheckBox.isSelected()); cellPageAttr.setCanBreakOnPaginate(canBreakOnPaginateCheckBox.isSelected());
} }
if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_CellWrite_Repeat_Content_When_Paging"))) { if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_CellPage_Repeat_Content_When_Paging"))) {
cellPageAttr.setRepeat(this.repeatCheckBox.isSelected()); cellPageAttr.setRepeat(this.repeatCheckBox.isSelected());
} }

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save