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. 162
      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. 169
      designer/src/com/fr/design/actions/cell/style/AlignmentAction.java
  11. 70
      designer/src/com/fr/design/actions/cell/style/ReportFontBoldAction.java
  12. 13
      designer/src/com/fr/design/actions/cell/style/ReportFontItalicAction.java
  13. 9
      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. 2
      designer/src/com/fr/design/actions/file/export/AbstractExportAction.java
  17. 4
      designer/src/com/fr/design/actions/insert/cell/FormulaCellAction.java
  18. 46
      designer/src/com/fr/design/actions/insert/flot/ChartFloatAction.java
  19. 224
      designer/src/com/fr/design/actions/insert/flot/FormulaFloatAction.java
  20. 33
      designer/src/com/fr/design/actions/insert/flot/ImageFloatAction.java
  21. 6
      designer/src/com/fr/design/actions/insert/flot/TextBoxFloatAction.java
  22. 41
      designer/src/com/fr/design/cell/bar/DynamicScrollButton.java
  23. 9
      designer/src/com/fr/design/cell/clipboard/CellElementsClip.java
  24. 2
      designer/src/com/fr/design/cell/editor/AbstractCellEditor.java
  25. 10
      designer/src/com/fr/design/cell/editor/FormulaCellEditor.java
  26. 10
      designer/src/com/fr/design/cell/editor/FormulaFloatEditor.java
  27. 29
      designer/src/com/fr/design/cell/editor/RichTextToolBar.java
  28. 2
      designer/src/com/fr/design/condition/HyperlinkPane.java
  29. 10
      designer/src/com/fr/design/condition/WidgetHighlightPane.java
  30. 1101
      designer/src/com/fr/design/dscolumn/DSColumnAdvancedPane.java
  31. 2
      designer/src/com/fr/design/dscolumn/DSColumnConditionsPane.java
  32. 79
      designer/src/com/fr/design/dscolumn/ResultSetGroupDockingPane.java
  33. 4
      designer/src/com/fr/design/dscolumn/SelectedDataColumnPane.java
  34. 6
      designer/src/com/fr/design/dscolumn/SpecifiedGroupAttrPane.java
  35. 10
      designer/src/com/fr/design/expand/SortExpandAttrPane.java
  36. 16
      designer/src/com/fr/design/headerfooter/HFAttributesEditDialog.java
  37. 5
      designer/src/com/fr/design/mainframe/ActiveKeyGenerator.java
  38. 1
      designer/src/com/fr/design/mainframe/AuthorityToolBarPane.java
  39. 8
      designer/src/com/fr/design/mainframe/CellElementPropertyPane.java
  40. 56
      designer/src/com/fr/design/mainframe/CellWidgetPropertyPane.java
  41. 111
      designer/src/com/fr/design/mainframe/ElementCasePane.java
  42. 102
      designer/src/com/fr/design/mainframe/ElementCasePaneDelegate.java
  43. 93
      designer/src/com/fr/design/mainframe/InformationCollector.java
  44. 22
      designer/src/com/fr/design/mainframe/JWorkBook.java
  45. 5
      designer/src/com/fr/design/mainframe/ReportComponent.java
  46. 51
      designer/src/com/fr/design/mainframe/ReportComponentComposite.java
  47. 30
      designer/src/com/fr/design/mainframe/ReportFloatPane.java
  48. 5
      designer/src/com/fr/design/mainframe/ReportHyperlinkGroupPane.java
  49. 27
      designer/src/com/fr/design/mainframe/ReportHyperlinkGroupPaneNoPop.java
  50. 44
      designer/src/com/fr/design/mainframe/SheetNameTabPane.java
  51. 11
      designer/src/com/fr/design/mainframe/WorkSheetDesigner.java
  52. 17
      designer/src/com/fr/design/mainframe/alphafine/AlphaFineConstants.java
  53. 4
      designer/src/com/fr/design/mainframe/alphafine/AlphaFineHelper.java
  54. 13
      designer/src/com/fr/design/mainframe/alphafine/cell/model/ActionModel.java
  55. 5
      designer/src/com/fr/design/mainframe/alphafine/cell/model/AlphaCellModel.java
  56. 15
      designer/src/com/fr/design/mainframe/alphafine/cell/render/ContentCellRender.java
  57. 9
      designer/src/com/fr/design/mainframe/alphafine/cell/render/TitleCellRender.java
  58. 351
      designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java
  59. 20
      designer/src/com/fr/design/mainframe/alphafine/component/AlphaFinePane.java
  60. BIN
      designer/src/com/fr/design/mainframe/alphafine/images/alphafine1@2x.png
  61. BIN
      designer/src/com/fr/design/mainframe/alphafine/images/alphafine2@2x.png
  62. BIN
      designer/src/com/fr/design/mainframe/alphafine/images/alphafine3@2x.png
  63. BIN
      designer/src/com/fr/design/mainframe/alphafine/images/alphafine4@2x.png
  64. BIN
      designer/src/com/fr/design/mainframe/alphafine/images/alphafine5@2x.png
  65. BIN
      designer/src/com/fr/design/mainframe/alphafine/images/alphafine_close@2x.png
  66. BIN
      designer/src/com/fr/design/mainframe/alphafine/images/bigloading.gif
  67. BIN
      designer/src/com/fr/design/mainframe/alphafine/images/bigsearch.png
  68. BIN
      designer/src/com/fr/design/mainframe/alphafine/images/bigsearch@2x.png
  69. BIN
      designer/src/com/fr/design/mainframe/alphafine/images/no_result.png
  70. BIN
      designer/src/com/fr/design/mainframe/alphafine/images/no_result@2x.png
  71. BIN
      designer/src/com/fr/design/mainframe/alphafine/images/noresult@2x.png
  72. BIN
      designer/src/com/fr/design/mainframe/alphafine/images/opening@2x.gif
  73. BIN
      designer/src/com/fr/design/mainframe/alphafine/images/selected1@2x.png
  74. BIN
      designer/src/com/fr/design/mainframe/alphafine/images/selected2@2x.png
  75. BIN
      designer/src/com/fr/design/mainframe/alphafine/images/selected3@2x.png
  76. BIN
      designer/src/com/fr/design/mainframe/alphafine/images/selected4@2x.png
  77. BIN
      designer/src/com/fr/design/mainframe/alphafine/images/selected5@2x.png
  78. BIN
      designer/src/com/fr/design/mainframe/alphafine/images/smallsearch.png
  79. BIN
      designer/src/com/fr/design/mainframe/alphafine/images/smallsearch@2x.png
  80. 37
      designer/src/com/fr/design/mainframe/alphafine/preview/ActionPreviewPane.java
  81. 29
      designer/src/com/fr/design/mainframe/alphafine/preview/DocumentPreviewPane.java
  82. 2
      designer/src/com/fr/design/mainframe/alphafine/preview/FilePreviewPane.java
  83. 32
      designer/src/com/fr/design/mainframe/alphafine/preview/NoResultPane.java
  84. 4
      designer/src/com/fr/design/mainframe/alphafine/preview/PluginPreviewPane.java
  85. 13
      designer/src/com/fr/design/mainframe/alphafine/search/manager/ActionSearchManager.java
  86. 14
      designer/src/com/fr/design/mainframe/alphafine/search/manager/DocumentSearchManager.java
  87. 20
      designer/src/com/fr/design/mainframe/alphafine/search/manager/FileSearchManager.java
  88. 14
      designer/src/com/fr/design/mainframe/alphafine/search/manager/PluginSearchManager.java
  89. 29
      designer/src/com/fr/design/mainframe/alphafine/search/manager/RecentSearchManager.java
  90. 2
      designer/src/com/fr/design/mainframe/alphafine/search/manager/RecommendSearchManager.java
  91. 92
      designer/src/com/fr/design/mainframe/bbs/BBSConstants.java
  92. 24
      designer/src/com/fr/design/mainframe/bbs/BBSGuestPane.java
  93. 8
      designer/src/com/fr/design/mainframe/bbs/BBSLoginDialog.java
  94. 6
      designer/src/com/fr/design/mainframe/bbs/ExitLabel.java
  95. 101
      designer/src/com/fr/design/mainframe/bbs/UserInfoLabel.java
  96. 46
      designer/src/com/fr/design/mainframe/bbs/UserInfoPane.java
  97. 12
      designer/src/com/fr/design/mainframe/bbs/bbs.properties
  98. 123
      designer/src/com/fr/design/mainframe/cell/AbstractDSCellEditorPane.java
  99. 28
      designer/src/com/fr/design/mainframe/cell/CellEditorPane.java
  100. 19
      designer/src/com/fr/design/mainframe/cell/CellElementEditPane.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:"build/classes/main")
copy(todir:"build/classes/"){
fileset(dir:"${basicDir}/core/build/classes/main")
fileset(dir:"${basicDir}/chart/build/classes/main")
fileset(dir:"${basicDir}/report/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")
jar(jarfile:"build/libs/fr-applet-9.0.jar"){
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;
public abstract class ButtonGroupAction extends ElementCaseAction{
protected Icon[] iconArray;
protected Icon[][] iconArray;
protected Integer[] valueArray;
private UIButtonGroup<Integer> group;
protected ButtonGroupAction(ElementCasePane t, Icon[] iconArray, Integer[] valueArray) {
protected ButtonGroupAction(ElementCasePane t, Icon[][] iconArray, Integer[] valueArray) {
super(t);
this.iconArray = iconArray;
this.valueArray = valueArray;
@ -36,7 +36,7 @@ public abstract class ButtonGroupAction extends ElementCaseAction{
break;
}
}
if(value == -1 && createToolBarComponent().hasClick()) {
if(createToolBarComponent().hasClick()) {
index = getSelectedIndex();
createToolBarComponent().setClickState(false);
}

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

@ -1,10 +1,10 @@
package com.fr.design.actions.cell;
import com.fr.design.actions.CellSelectionAction;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.ElementCasePane;
import com.fr.grid.GridUtils;
import com.fr.grid.selection.CellSelection;
@ -14,87 +14,93 @@ import com.fr.report.core.SheetUtils;
import com.fr.report.elementcase.TemplateElementCase;
import com.fr.report.stable.ReportConstants;
// TODO ALEX_SEP 这个类与AbstractCellAction有什么关系?
/**
* TODO ALEX_SEP 这个类与AbstractCellAction有什么关系?
*
* @author null
*/
public abstract class AbstractCellElementAction extends CellSelectionAction {
protected AbstractCellElementAction(ElementCasePane t) {
super(t);
}
@Override
protected boolean executeActionReturnUndoRecordNeededWithCellSelection(CellSelection cs) {
final ElementCasePane ePane = this.getEditingComponent();
final TemplateElementCase tplEC = ePane.getEditingElementCase();
TemplateCellElement editCellElement = tplEC.getTemplateCellElement(cs.getColumn(), cs.getRow());
if (editCellElement == null) {
editCellElement = new DefaultTemplateCellElement(cs.getColumn(), cs.getRow());
tplEC.addCellElement(editCellElement);
}
if (tplEC != null) {
SheetUtils.calculateDefaultParent(tplEC);
}
final CellSelection finalCS = cs;
final BasicPane bp = populateBasicPane(editCellElement);
BasicDialog dialog = bp.showWindow(DesignerContext.getDesignerFrame());
dialog.addDialogActionListener(new DialogActionAdapter() {
@Override
public void doOk() {
// 需要先行后列地增加新元素。
for (int j = 0; j < finalCS.getRowSpan(); j++) {
for (int i = 0; i < finalCS.getColumnSpan(); i++) {
int column = i + finalCS.getColumn();
int row = j + finalCS.getRow();
TemplateCellElement editCellElement = tplEC.getTemplateCellElement(column, row);
if (editCellElement == null) {
editCellElement = new DefaultTemplateCellElement(column, row);
tplEC.addCellElement(editCellElement);
}
// alex:不加这一句话会导致跨行跨列的格子被多次update
if (editCellElement.getColumn() != column || editCellElement.getRow() != row) {
continue;
}
updateBasicPane(bp, editCellElement);
// update cell attributes
if (isNeedShinkToFit()) {
// shink to fit.(如果value是String)
Object editElementValue = editCellElement.getValue();
if (editElementValue != null && (editElementValue instanceof String || editElementValue instanceof Number)) {
// TODO ALEX_SEP 暂时用FIT_DEFAULT替代,不取reportsetting里面的设置,因为也不知道是应该放在report里面还是elementcase里面
GridUtils.shrinkToFit(ReportConstants.AUTO_SHRINK_TO_FIT_DEFAULT, tplEC, editCellElement);
}
}
}
}
ePane.fireTargetModified();
}
});
protected AbstractCellElementAction() {
super();
}
protected AbstractCellElementAction(ElementCasePane t) {
super(t);
}
@Override
protected boolean executeActionReturnUndoRecordNeededWithCellSelection(CellSelection cs) {
final ElementCasePane ePane = this.getEditingComponent();
final TemplateElementCase tplEC = ePane.getEditingElementCase();
TemplateCellElement editCellElement = tplEC.getTemplateCellElement(cs.getColumn(), cs.getRow());
if (editCellElement == null) {
editCellElement = new DefaultTemplateCellElement(cs.getColumn(), cs.getRow());
tplEC.addCellElement(editCellElement);
}
SheetUtils.calculateDefaultParent(tplEC);
final CellSelection finalCS = cs;
final BasicPane bp = populateBasicPane(editCellElement);
BasicDialog dialog = bp.showWindow(DesignerContext.getDesignerFrame());
dialog.addDialogActionListener(new DialogActionAdapter() {
@Override
public void doOk() {
// 需要先行后列地增加新元素。
for (int j = 0; j < finalCS.getRowSpan(); j++) {
for (int i = 0; i < finalCS.getColumnSpan(); i++) {
int column = i + finalCS.getColumn();
int row = j + finalCS.getRow();
TemplateCellElement editCellElement = tplEC.getTemplateCellElement(column, row);
if (editCellElement == null) {
editCellElement = new DefaultTemplateCellElement(column, row);
tplEC.addCellElement(editCellElement);
}
// alex:不加这一句话会导致跨行跨列的格子被多次update
if (editCellElement.getColumn() != column || editCellElement.getRow() != row) {
continue;
}
updateBasicPane(bp, editCellElement);
// update cell attributes
if (isNeedShinkToFit()) {
// shink to fit.(如果value是String)
Object editElementValue = editCellElement.getValue();
if (editElementValue != null && (editElementValue instanceof String || editElementValue instanceof Number)) {
// TODO ALEX_SEP 暂时用FIT_DEFAULT替代,不取reportsetting里面的设置,因为也不知道是应该放在report里面还是elementcase里面
GridUtils.shrinkToFit(ReportConstants.AUTO_SHRINK_TO_FIT_DEFAULT, tplEC, editCellElement);
}
}
}
}
ePane.fireTargetModified();
}
});
//控件设置记住dlg,提交入库智能添加单元格后可以show出来
DesignerContext.setReportWritePane(dialog);
dialog.setVisible(true);
return false;
}
dialog.setVisible(true);
return false;
}
/**
* 初始化对话框
*
* @param cellElement
* @return
*/
protected abstract BasicPane populateBasicPane(TemplateCellElement cellElement);
/**
* 初始化对话框
*
* @param cellElement 单元格
* @return 对话框
*/
protected abstract BasicPane populateBasicPane(TemplateCellElement cellElement);
/**
* 更新对话框之后改变值
*
* @param cellElement
* @return
*/
protected abstract void updateBasicPane(BasicPane basicPane, TemplateCellElement cellElement);
/**
* 更新对话框之后改变值
*
* @param cellElement 单元格
*/
protected abstract void updateBasicPane(BasicPane basicPane, TemplateCellElement cellElement);
/**
* if isNeedShinkToFitplease override this method
*
* @return isNeedShinkToFit
*/
protected boolean isNeedShinkToFit() {
return false;
}
/**
* if isNeedShinkToFitplease override this method
*
* @return isNeedShinkToFit
*/
protected boolean isNeedShinkToFit() {
return false;
}
}

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

@ -1,5 +1,6 @@
package com.fr.design.actions.cell;
import com.fr.base.BaseUtils;
import com.fr.design.menu.KeySetUtils;
import com.fr.general.Inter;
@ -9,9 +10,9 @@ import com.fr.general.Inter;
public class CellAttributeAction extends CellAttributeTableAction {
public CellAttributeAction() {
this.setMenuKeySet(KeySetUtils.CELL_OTHER_ATTR);
this.setName(getMenuKeySet().getMenuKeySetName()+ "...");
this.setName(getMenuKeySet().getMenuKeySetName());
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

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

@ -1,9 +1,10 @@
package com.fr.design.actions.cell;
import java.awt.event.ActionEvent;
import com.fr.design.actions.UpdateAction;
import com.fr.design.mainframe.CellElementPropertyPane;
import com.fr.design.mainframe.EastRegionContainerPane;
import java.awt.event.ActionEvent;
/**
* 所有的CellAttributeTableAction都是指向单元格属性表的,点了就自动跳转到单元格属性表
@ -20,4 +21,9 @@ public abstract class CellAttributeTableAction extends UpdateAction {
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;
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.present.CellWriteAttrPane;
import com.fr.design.dialog.BasicPane;
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;
import java.awt.event.ActionEvent;
/**
* Cell Widget Attribute.
*/
public class CellWidgetAttrAction extends AbstractCellElementAction {
public class CellWidgetAttrAction extends UpdateAction {
public CellWidgetAttrAction(ElementCasePane t) {
super(t);
public CellWidgetAttrAction() {
this.setMenuKeySet(KeySetUtils.CELL_WIDGET_ATTR);
this.setName(getMenuKeySet().getMenuKeySetName());
this.setMnemonic(getMenuKeySet().getMnemonic());
@ -26,47 +20,14 @@ public class CellWidgetAttrAction extends AbstractCellElementAction {
}
@Override
protected BasicPane populateBasicPane(TemplateCellElement cellElement) {
CellWriteAttrPane pane = new CellWriteAttrPane(this.getEditingComponent());
//got simple cell element from column and row.
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;
public void actionPerformed(ActionEvent e) {
EastRegionContainerPane.getInstance().switchTabTo(EastRegionContainerPane.KEY_WIDGET_SETTINGS);
EastRegionContainerPane.getInstance().setWindow2PreferWidth();
}
@Override
public void update() {
ElementCasePane ePane = this.getEditingComponent();
Selection sel = ePane.getSelection();
if (sel instanceof CellSelection) {
this.setEnabled(true);
} else {
this.setEnabled(false);
}
super.update();
this.setEnabled(EastRegionContainerPane.getInstance().isWidgetSettingsPaneEnabled());
}
}

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());
CellElementPropertyPane.getInstance().GoToPane(Inter.getLocText("FR-Designer-Widget_Style"));
return true;
}

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

@ -1,40 +1,49 @@
package com.fr.design.actions.cell.style;
import javax.swing.Icon;
import com.fr.base.BaseUtils;
import com.fr.base.Style;
import com.fr.base.chart.BaseChartCollection;
import com.fr.design.constants.UIConstants;
import com.fr.design.actions.ButtonGroupAction;
import com.fr.design.actions.utils.ReportActionUtils;
import com.fr.design.constants.UIConstants;
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.general.Inter;
import com.fr.grid.selection.FloatSelection;
import com.fr.grid.selection.Selection;
import com.fr.report.cell.FloatElement;
import com.fr.report.elementcase.TemplateElementCase;
import com.fr.stable.Constants;
import javax.swing.*;
public class AlignmentAction extends ButtonGroupAction implements StyleActionInterface {
public AlignmentAction(ElementCasePane t, Icon[] iconArray,
Integer[] valueArray) {
super(t, iconArray, valueArray);
}
private static final Icon[][] ICONS = new Icon[][]{
{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")},
{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")}};
/**
* executeStyle
*
* @param style
* @param selectedStyle
* @return style
*/
public Style executeStyle(Style style, Style selectedStyle) {
return style.deriveHorizontalAlignment(getSelectedValue());
}
private static final Integer[] valueArray = new Integer[]{Constants.LEFT, Constants.CENTER, Constants.RIGHT};
public AlignmentAction(ElementCasePane t) {
super(t, ICONS, valueArray);
}
/**
* executeStyle
*
* @param style
* @param selectedStyle
* @return style
*/
public Style executeStyle(Style style, Style selectedStyle) {
return style.deriveHorizontalAlignment(getSelectedValue());
}
/**
* 更新Style
@ -45,67 +54,67 @@ public class AlignmentAction extends ButtonGroupAction implements StyleActionInt
setSelectedIndex(BaseUtils.getAlignment4Horizontal(style));
}
/**
* executeActionReturnUndoRecordNeeded
*
* @return
*/
public boolean executeActionReturnUndoRecordNeeded() {
ElementCasePane reportPane = this.getEditingComponent();
if (reportPane == null) {
return false;
}
return ReportActionUtils.executeAction(this, reportPane);
}
/**
* update
*/
public void update() {
super.update();
//peter:如果当前没有ReportFrame,不需要继续.
if (!this.isEnabled()) {
return;
}
//got simple cell element from row and column
ElementCasePane reportPane = this.getEditingComponent();
if (reportPane == null) {
this.setEnabled(false);
return;
}
Selection cs = reportPane.getSelection();
TemplateElementCase tplEC = reportPane.getEditingElementCase();
if (tplEC != null && cs instanceof FloatSelection) {
FloatElement selectedFloat = tplEC.getFloatElement(((FloatSelection) cs).getSelectedFloatName());
Object value = selectedFloat.getValue();
if (value instanceof BaseChartCollection) {
this.setEnabled(false);
return;
}
}
this.updateStyle(ReportActionUtils.getCurrentStyle(reportPane));
}
/**
* 创建工具条且有提示
*
* @return
*/
public UIButtonGroup<Integer> createToolBarComponent() {
UIButtonGroup<Integer> group = super.createToolBarComponent();
if (group != null) {
group.setForToolBarButtonGroup(true);
group.setAllToolTips(new String[]{Inter.getLocText("StyleAlignment-Left"), Inter.getLocText("Center"), Inter.getLocText("StyleAlignment-Right")});
}
for (int i = 0; i < 3; i++) {
group.getButton(i).setRoundBorder(true, UIConstants.ARC);
group.getButton(i).setBorderPainted(true);
}
return group;
}
/**
* executeActionReturnUndoRecordNeeded
*
* @return
*/
public boolean executeActionReturnUndoRecordNeeded() {
ElementCasePane reportPane = this.getEditingComponent();
if (reportPane == null) {
return false;
}
return ReportActionUtils.executeAction(this, reportPane);
}
/**
* update
*/
public void update() {
super.update();
//peter:如果当前没有ReportFrame,不需要继续.
if (!this.isEnabled()) {
return;
}
//got simple cell element from row and column
ElementCasePane reportPane = this.getEditingComponent();
if (reportPane == null) {
this.setEnabled(false);
return;
}
Selection cs = reportPane.getSelection();
TemplateElementCase tplEC = reportPane.getEditingElementCase();
if (tplEC != null && cs instanceof FloatSelection) {
FloatElement selectedFloat = tplEC.getFloatElement(((FloatSelection) cs).getSelectedFloatName());
Object value = selectedFloat.getValue();
if (value instanceof BaseChartCollection) {
this.setEnabled(false);
return;
}
}
this.updateStyle(ReportActionUtils.getCurrentStyle(reportPane));
}
/**
* 创建工具条且有提示
*
* @return
*/
public UIButtonGroup<Integer> createToolBarComponent() {
UIButtonGroup<Integer> group = super.createToolBarComponent();
if (group != null) {
group.setForToolBarButtonGroup(true);
group.setAllToolTips(new String[]{Inter.getLocText("StyleAlignment-Left"), Inter.getLocText("Center"), Inter.getLocText("StyleAlignment-Right")});
}
for (int i = 0; i < 3; i++) {
group.getButton(i).setRoundBorder(true, UIConstants.ARC);
group.getButton(i).setBorderPainted(true);
}
return group;
}
}

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

@ -8,24 +8,27 @@ import com.fr.base.Style;
import com.fr.base.core.StyleUtils;
import com.fr.design.actions.ToggleButtonUpdateAction;
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.utils.gui.GUICoreUtils;
import com.fr.general.FRFont;
import com.fr.general.Inter;
import javax.swing.*;
/**
* Bold.
*/
public class ReportFontBoldAction extends AbstractStyleAction implements ToggleButtonUpdateAction {
private UIToggleButton button;
protected Style style;
private UIToggleButton button;
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) {
super(t);
public ReportFontBoldAction(ElementCasePane t) {
super(t);
this.setName(Inter.getLocText("FRFont-bold"));
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/bold.png"));
}
this.setName(Inter.getLocText("FRFont-bold"));
this.setSmallIcon(ICONS, true);
}
/**
* 根据按钮状态获取格式
@ -45,16 +48,17 @@ public class ReportFontBoldAction extends AbstractStyleAction implements ToggleB
createToolBarComponent().setSelected(true);
}
return this.style;
}
return this.style;
}
protected void setSelectedFont(Style style) {
this.style = StyleUtils.boldReportFont(style);
}
protected void setUnselectedFont(Style style) {
this.style = StyleUtils.unBoldReportFont(style);
}
protected void setSelectedFont(Style style) {
this.style = StyleUtils.boldReportFont(style);
}
protected void setUnselectedFont(Style style) {
this.style = StyleUtils.unBoldReportFont(style);
}
/**
* Update Style.
@ -71,21 +75,21 @@ public class ReportFontBoldAction extends AbstractStyleAction implements ToggleB
createToolBarComponent().setSelected(isStyle(frFont));
}
protected boolean isStyle(FRFont frFont) {
return frFont.isBold();
}
protected boolean isStyle(FRFont frFont) {
return frFont.isBold();
}
/**
* Gets component on toolbar.
*
* @return the created components on toolbar.
*/
@Override
public UIToggleButton createToolBarComponent() {
if (button == null) {
button = GUICoreUtils.createToolBarComponent(this);
button.setEventBannded(true);
}
return button;
}
/**
* Gets component on toolbar.
*
* @return the created components on toolbar.
*/
@Override
public UIToggleButton createToolBarComponent() {
if (button == null) {
button = GUICoreUtils.createToolBarComponentWhiteIcon(this);
button.setEventBannded(true);
}
return button;
}
}

13
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.design.mainframe.ElementCasePane;
import javax.swing.*;
/**
* Bold.
*/
public class ReportFontItalicAction extends ReportFontBoldAction {
public ReportFontItalicAction(ElementCasePane t) {
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) {
super(t);
this.setName(Inter.getLocText("FRFont-italic"));
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/italic.png"));
this.setName(Inter.getLocText("FR-Designer-FRFont_Italic"));
this.setSmallIcon(ICONS, true);
}
@ -31,7 +35,6 @@ public class ReportFontItalicAction extends ReportFontBoldAction {
this.style = StyleUtils.unItalicReportFont(style);
}
protected boolean isStyle(FRFont frFont) {
return frFont.isItalic();
}

9
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.stable.Constants;
import javax.swing.*;
/**
* Bold.
*/
public class ReportFontUnderlineAction extends ReportFontBoldAction {
public ReportFontUnderlineAction(ElementCasePane t) {
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) {
super(t);
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) {

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.report.cell.TemplateCellElement;
/**
* 数据列过滤条件Action
*
* @author null
* @version 2017年11月17日15点11分
* @since 8.0
*/
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) {
super(t);
this.setName(Inter.getLocText("Filter"));
this.setMnemonic('E');
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/expand/cellAttr.gif"));
}
@Override
public void setEditingComponent(ElementCasePane casePane) {
super.setEditingComponent(casePane);
}
@Override
protected BasicPane populateBasicPane(TemplateCellElement cellElement) {
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();
}
}

2
designer/src/com/fr/design/actions/file/export/AbstractExportAction.java

@ -139,7 +139,7 @@ public abstract class AbstractExportAction extends JWorkBookAction {
if (exporter instanceof AppExporter) {
AppExporter appExporter = (AppExporter) exporter;
if (exporter instanceof ExcelExporter || exporter instanceof CSVExporter
|| exporter instanceof PDFExporterProcessor || exporter instanceof WordExporter) {
|| exporter instanceof PDFExporterProcessor || exporter instanceof WordExporter) {
ReportHelper.clearFormulaResult(tpl);// 清空rpt中的公式计算结果
appExporter.export(fileOutputStream, tpl.execute(parameterMap, ActorFactory.getActor(ActorConstants.TYPE_PAGE)

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

@ -3,8 +3,8 @@
*/
package com.fr.design.actions.insert.cell;
import com.fr.base.BaseFormula;
import com.fr.base.BaseUtils;
import com.fr.base.Formula;
import com.fr.design.actions.core.WorkBookSupportable;
import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.menu.MenuKeySet;
@ -48,6 +48,6 @@ public class FormulaCellAction extends AbstractCellAction implements WorkBookSup
@Override
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;
import com.fr.base.BaseUtils;
import com.fr.base.DynamicUnitList;
import com.fr.base.Style;
import com.fr.base.chart.BaseChartCollection;
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.general.FRLogger;
import com.fr.general.Inter;
import com.fr.grid.Grid;
import com.fr.grid.selection.FloatSelection;
import com.fr.report.ReportHelper;
import com.fr.report.cell.FloatElement;
import com.fr.report.elementcase.TemplateElementCase;
import com.fr.stable.Constants;
import com.fr.stable.bridge.StableFactory;
import com.fr.stable.unit.FU;
import com.fr.stable.unit.OLDPIX;
import javax.swing.*;
@ -30,13 +35,15 @@ import java.awt.*;
*/
public class ChartFloatAction extends ElementCaseAction {
private boolean isRecordNeeded;
/**
* 构造函数 图表插入悬浮元素
*/
public ChartFloatAction(ElementCasePane t) {
super(t);
this.setMenuKeySet(FLOAT_INSERT_CHART);
this.setName(getMenuKeySet().getMenuKeySetName() + "...");
this.setName(getMenuKeySet().getMenuKeySetName());
this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_insert/chart.png"));
}
@ -64,9 +71,10 @@ public class ChartFloatAction extends ElementCaseAction {
* @return 是则返回true
*/
public boolean executeActionReturnUndoRecordNeeded() {
isRecordNeeded = false;
final ElementCasePane reportPane = (ElementCasePane) HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getCurrentElementCasePane();
if (reportPane == null) {
return false;
return isRecordNeeded;
}
reportPane.stopEditing();
@ -78,25 +86,41 @@ public class ChartFloatAction extends ElementCaseAction {
chartDialog.addDialogActionListener(new DialogActionAdapter() {
@Override
public void doOk() {
isRecordNeeded = true;
FloatElement newFloatElement;
try {
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.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();
if (style != null) {
newFloatElement.setStyle(style.deriveBorder(Constants.LINE_NONE, Color.black,
Constants.LINE_NONE, Color.black,
Constants.LINE_NONE, Color.black,
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));
}
reportPane.getEditingElementCase().addFloatElement(newFloatElement);
reportPane.setSelection(new FloatSelection(newFloatElement.getName()));
reportPane.fireTargetModified();
reportPane.fireSelectionChangeListener();
} catch (CloneNotSupportedException e) {
FRLogger.getLogger().error("Error in Float");
@ -105,6 +129,6 @@ public class ChartFloatAction extends ElementCaseAction {
});
chartDialog.setVisible(true);
return true;
return isRecordNeeded;
}
}

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

@ -1,98 +1,128 @@
/*
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved.
*/
package com.fr.design.actions.insert.flot;
import com.fr.base.BaseUtils;
import com.fr.base.DynamicUnitList;
import com.fr.base.Formula;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.menu.MenuKeySet;
import com.fr.general.Inter;
import com.fr.grid.Grid;
import com.fr.grid.selection.FloatSelection;
import com.fr.report.ReportHelper;
import com.fr.report.cell.FloatElement;
import com.fr.report.elementcase.TemplateElementCase;
import com.fr.stable.unit.FU;
import javax.swing.*;
import java.awt.event.ActionEvent;
/**
* Insert formula.
*/
public class FormulaFloatAction extends AbstractShapeAction {
public FormulaFloatAction(ElementCasePane t) {
super(t);
this.setMenuKeySet(FLOAT_INSERT_FORMULA);
this.setName(getMenuKeySet().getMenuKeySetName() + "...");
this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_insert/formula.png"));
}
public static final MenuKeySet FLOAT_INSERT_FORMULA = new MenuKeySet() {
@Override
public char getMnemonic() {
return 'F';
}
@Override
public String getMenuName() {
return Inter.getLocText("FR-Designer_Insert_Formula");
}
@Override
public KeyStroke getKeyStroke() {
return null;
}
};
/**
* 动作
*
* @param e 事件
*/
public void actionPerformed(ActionEvent e) {
ElementCasePane jws = getEditingComponent();
if (jws == null) {
return;
}
//
FloatElement floatElement = new FloatElement(new Formula(""));
this.startDraw(floatElement);
doWithDrawingFloatElement();
jws.getGrid().startEditing();
}
private void doWithDrawingFloatElement() {
ElementCasePane jws = (ElementCasePane) HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getCurrentElementCasePane();
Grid grid = jws.getGrid();
ElementCasePane reportPane = grid.getElementCasePane();
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 = grid.getDrawingFloatElement().getWidth().toPixI(resolution);
int floatHeight = grid.getDrawingFloatElement().getWidth().toPixI(resolution);
FU evtX_fu = FU.valueOfPix((grid.getWidth() - floatWdith) / 2, resolution);
FU evtY_fu = FU.valueOfPix((grid.getHeight() - floatHeight) / 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());
grid.getDrawingFloatElement().setLeftDistance(leftDistance);
grid.getDrawingFloatElement().setTopDistance(topDistance);
report.addFloatElement(grid.getDrawingFloatElement());
reportPane.setSelection(new FloatSelection(grid.getDrawingFloatElement().getName()));
}
/*
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved.
*/
package com.fr.design.actions.insert.flot;
import com.fr.base.BaseFormula;
import com.fr.base.BaseUtils;
import com.fr.base.DynamicUnitList;
import com.fr.design.actions.ElementCaseAction;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.formula.FormulaFactory;
import com.fr.design.formula.UIFormula;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.menu.MenuKeySet;
import com.fr.general.Inter;
import com.fr.grid.Grid;
import com.fr.grid.selection.FloatSelection;
import com.fr.report.ReportHelper;
import com.fr.report.cell.FloatElement;
import com.fr.report.elementcase.TemplateElementCase;
import com.fr.stable.unit.FU;
import javax.swing.*;
/**
* Insert formula.
*/
public class FormulaFloatAction extends ElementCaseAction {
private boolean returnValue = false;
public FormulaFloatAction(ElementCasePane t) {
super(t);
this.setMenuKeySet(FLOAT_INSERT_FORMULA);
this.setName(getMenuKeySet().getMenuKeySetName());
this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_insert/formula.png"));
}
public static final MenuKeySet FLOAT_INSERT_FORMULA = new MenuKeySet() {
@Override
public char getMnemonic() {
return 'F';
}
@Override
public String getMenuName() {
return Inter.getLocText("FR-Designer_Insert_Formula");
}
@Override
public KeyStroke getKeyStroke() {
return null;
}
};
private void doWithDrawingFloatElement() {
ElementCasePane jws = (ElementCasePane) HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getCurrentElementCasePane();
Grid grid = jws.getGrid();
ElementCasePane reportPane = grid.getElementCasePane();
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 = grid.getDrawingFloatElement().getWidth().toPixI(resolution);
int floatHeight = grid.getDrawingFloatElement().getWidth().toPixI(resolution);
FU evtX_fu = FU.valueOfPix((grid.getWidth() - floatWdith) / 2, resolution);
FU evtY_fu = FU.valueOfPix((grid.getHeight() - floatHeight) / 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());
grid.getDrawingFloatElement().setLeftDistance(leftDistance);
grid.getDrawingFloatElement().setTopDistance(topDistance);
report.addFloatElement(grid.getDrawingFloatElement());
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;
import com.fr.base.BaseUtils;
import com.fr.base.DynamicUnitList;
import com.fr.base.ScreenResolution;
import com.fr.design.actions.ElementCaseAction;
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.report.SelectImagePane;
import com.fr.general.Inter;
import com.fr.grid.Grid;
import com.fr.grid.selection.FloatSelection;
import com.fr.report.ReportHelper;
import com.fr.report.cell.FloatElement;
import com.fr.report.cell.cellattr.CellImage;
import com.fr.report.elementcase.TemplateElementCase;
import com.fr.stable.CoreGraphHelper;
import com.fr.stable.unit.FU;
@ -34,7 +38,7 @@ public class ImageFloatAction extends ElementCaseAction {
public ImageFloatAction(ElementCasePane t) {
super(t);
this.setMenuKeySet(FLOAT_INSERT_IMAGE);
this.setName(getMenuKeySet().getMenuKeySetName() + "...");
this.setName(getMenuKeySet().getMenuKeySetName());
this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_insert/image.png"));
}
@ -87,12 +91,33 @@ public class ImageFloatAction extends ElementCaseAction {
CoreGraphHelper.waitForImage(image);
floatElement.setValue(image);
int resolution = ScreenResolution.getScreenResolution();
Grid grid = reportPane.getGrid();
int resolution = grid.getResolution();
floatElement.setWidth(FU.valueOfPix(image.getWidth(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());
reportPane.addFloatElementToCenterOfElementPane(floatElement);
// reportPane.addFloatElementToCenterOfElementPane(floatElement);
reportPane.getEditingElementCase().addFloatElement(floatElement);
reportPane.setSelection(new FloatSelection(floatElement.getName()));
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) {
super(t);
this.setMenuKeySet(FLOAT_INSERT_TEXT);
this.setName(getMenuKeySet().getMenuKeySetName() + "...");
this.setName(getMenuKeySet().getMenuKeySetName());
this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_insert/text.png"));
}
@ -54,6 +54,7 @@ public class TextBoxFloatAction extends AbstractShapeAction {
*
* @param e 动作
*/
@Override
public void actionPerformed(ActionEvent e) {
ElementCasePane jws = getEditingComponent();
if (jws == null) {
@ -67,7 +68,7 @@ public class TextBoxFloatAction extends AbstractShapeAction {
private void doWithDrawingFloatElement() {
ElementCasePane jws = (ElementCasePane) HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getCurrentElementCasePane();
;
Grid grid = jws.getGrid();
ElementCasePane reportPane = grid.getElementCasePane();
@ -93,5 +94,6 @@ public class TextBoxFloatAction extends AbstractShapeAction {
report.addFloatElement(grid.getDrawingFloatElement());
reportPane.setSelection(new FloatSelection(grid.getDrawingFloatElement().getName()));
reportPane.fireTargetModified();
}
}

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

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

9
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.TemplateCellElement;
import com.fr.report.elementcase.TemplateElementCase;
import com.fr.stable.StringUtils;
import com.fr.stable.unit.FU;
/**
@ -62,8 +63,12 @@ public class CellElementsClip implements Cloneable, java.io.Serializable {
if (sbuf.length() > 0 && sbuf.charAt(sbuf.length() - 1) != '\n') {
sbuf.append('\t');
}
sbuf.append(cellElement.getValue());
//REPORT-5134:会复制出null
if (cellElement.getValue() == null) {
sbuf.append(StringUtils.EMPTY);
} else {
sbuf.append(cellElement.getValue());
}
}
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 com.fr.design.mainframe.EastRegionContainerPane;
import com.fr.design.mainframe.ElementCasePane;
import com.fr.grid.event.CellEditorEvent;
import com.fr.grid.event.CellEditorListener;
@ -114,6 +115,7 @@ public abstract class AbstractCellEditor implements CellEditor {
}
if(ePane != null) {
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;
import com.fr.base.Formula;
import com.fr.base.BaseFormula;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.formula.FormulaFactory;
import com.fr.design.formula.UIFormula;
@ -34,7 +34,7 @@ public class FormulaCellEditor extends com.fr.design.cell.editor.AbstractCellEdi
*/
@Override
public Object getCellEditorValue() throws Exception {
Formula newFormula = this.formulaEditorPane.update();
BaseFormula newFormula = this.formulaEditorPane.update();
if (newFormula.getContent() != null && newFormula.getContent().trim().length() > 1) {
return newFormula;
} else {
@ -64,13 +64,13 @@ public class FormulaCellEditor extends com.fr.design.cell.editor.AbstractCellEdi
if (cellElement != null) {
value = cellElement.getValue();
}
if (value == null || !(value instanceof Formula)) {
value = new Formula("");
if (value == null || !(value instanceof BaseFormula)) {
value = BaseFormula.createFormulaBuilder().build();
}
this.formulaEditorPane = FormulaFactory.createFormulaPaneWhenReserveFormula();
this.formulaEditorPane.populate((Formula) value);
this.formulaEditorPane.populate((BaseFormula) value);
return this.formulaEditorPane.showLargeWindow(SwingUtilities.getWindowAncestor(grid), new DialogActionAdapter() {
@Override

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

@ -3,7 +3,7 @@
*/
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.formula.FormulaFactory;
import com.fr.design.formula.UIFormula;
@ -31,7 +31,7 @@ public class FormulaFloatEditor extends AbstractFloatEditor {
*/
@Override
public Object getFloatEditorValue() throws Exception {
Formula newFormula = this.formulaEditorPane.update();
BaseFormula newFormula = this.formulaEditorPane.update();
if (newFormula.getContent() != null && newFormula.getContent().trim().length() > 1) {
return newFormula;
} else {
@ -59,12 +59,12 @@ public class FormulaFloatEditor extends AbstractFloatEditor {
public Component getFloatEditorComponent(Grid grid, FloatElement floatElement, int resolution) {
//populate data to UI
Object value = floatElement.getValue();
if (value == null || !(value instanceof com.fr.base.Formula)) {
value = new Formula("");
if (value == null || !(value instanceof BaseFormula)) {
value = BaseFormula.createFormulaBuilder().build();
}
this.formulaEditorPane = FormulaFactory.createFormulaPane();
this.formulaEditorPane.populate((Formula) value);
this.formulaEditorPane.populate((BaseFormula) value);
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;
import com.fr.base.BaseFormula;
import com.fr.base.BaseUtils;
import com.fr.base.FRContext;
import com.fr.base.Formula;
import com.fr.base.Utils;
import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.DialogActionAdapter;
@ -27,10 +27,27 @@ import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils;
import javax.swing.*;
import javax.swing.event.*;
import javax.swing.text.*;
import javax.swing.event.CaretEvent;
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.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;
/**
@ -311,12 +328,12 @@ public class RichTextToolBar extends BasicPane{
private ActionListener formulaActionListener = new ActionListener() {
public void actionPerformed(ActionEvent evt) {
final UIFormula formulaPane = FormulaFactory.createFormulaPane();
formulaPane.populate(new Formula());
formulaPane.populate(BaseFormula.createFormulaBuilder().build());
formulaPane.showLargeWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() {
@Override
public void doOk() {
StyledDocument doc = (StyledDocument) textPane.getDocument();
Formula fm = formulaPane.update();
BaseFormula fm = formulaPane.update();
String content = RichTextConverter.asFormula(fm.getContent());
int start = textPane.getSelectionStart();
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() {
public void actionPerformed(ActionEvent e) {
NameJavaScriptGroup nameHyperlinks = jsGroup;
pane = DesignerContext.getDesignerFrame().getSelectedJTemplate().getHyperLinkPane(HyperlinkGroupPaneActionImpl.getInstance());
pane = DesignerContext.getDesignerFrame().getSelectedJTemplate().getHyperLinkPaneNoPop(HyperlinkGroupPaneActionImpl.getInstance());
pane.populate(nameHyperlinks);
dialog = pane.showWindow(SwingUtilities.getWindowAncestor(conditionAttributesPane));
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.icombobox.UIComboBox;
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.form.ui.*;
import com.fr.general.Inter;
@ -35,7 +38,12 @@ public class WidgetHighlightPane extends ConditionAttrSingleConditionPane<Highli
widgetButton = new UIButton(Inter.getLocText("FR-Designer_Edit"));
widgetButton.addActionListener(new ActionListener() {
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);
BasicDialog dialog = widgetPane.showWindow(
SwingUtilities.getWindowAncestor(conditionAttributesPane));

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

File diff suppressed because it is too large Load Diff

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

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

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

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

@ -41,7 +41,7 @@ import java.util.regex.Pattern;
*
* @author yaoh.wu
* @version 2017年8月3日
* 复用对话框代码保留对话框原始布局
* 复用对话框代码保留对话框原始布局
* @since 8.0
*/
public class SelectedDataColumnPane extends BasicPane {
@ -282,7 +282,7 @@ public class SelectedDataColumnPane extends BasicPane {
private void initWithParameterButton(final ElementCasePane casePane, final TemplateCellElement cellElement) {
final SelectedDataColumnPane that = this;
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() {
public void actionPerformed(ActionEvent e) {
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;
import com.fr.base.Formula;
import com.fr.base.BaseFormula;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.condition.DSColumnLiteConditionPane;
import com.fr.design.dialog.BasicPane;
@ -333,7 +333,7 @@ public class SpecifiedGroupAttrPane extends BasicPane {
formulaButton.setPreferredSize(new Dimension(25, valueField.getPreferredSize().height));
formulaButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
Formula valueFormula = new Formula();
BaseFormula valueFormula = BaseFormula.createFormulaBuilder().build();
String text = valueField.getText();
if (text == null || text.length() <= 0) {
valueFormula.setContent("$$$");
@ -347,7 +347,7 @@ public class SpecifiedGroupAttrPane extends BasicPane {
formulaPane.showLargeWindow(SwingUtilities.getWindowAncestor(FormulaGroupPane.this), new DialogActionAdapter(){
@Override
public void doOk() {
Formula valueFormula = formulaPane.update();
BaseFormula valueFormula = formulaPane.update();
if (valueFormula.getContent().length() <= 1) {
valueField.setText("$$$");
} else {

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

@ -24,11 +24,11 @@ public class SortExpandAttrPane extends JPanel {
public SortExpandAttrPane() {
this.setLayout(new BorderLayout(0, 4));
Icon[] iconArray = {
BaseUtils.readIcon("/com/fr/design/images/expand/none16x16.png"),
BaseUtils.readIcon("/com/fr/design/images/expand/asc.png"),
BaseUtils.readIcon("/com/fr/design/images/expand/des.png")
};
Icon[][] iconArray = {
{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_selected.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") };
sort_type_pane = new UIButtonGroup(iconArray);
sort_type_pane.setAllToolTips(nameArray);

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

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

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

@ -1,7 +1,6 @@
package com.fr.design.mainframe;
import com.fr.base.BaseUtils;
import com.fr.base.ConfigManager;
import com.fr.design.DesignerEnvManager;
import com.fr.design.mainframe.bbs.BBSConstants;
import com.fr.general.SiteCenter;
import com.fr.general.http.HttpClient;
import com.fr.stable.StableUtils;
@ -102,7 +101,7 @@ public class ActiveKeyGenerator {
HashMap<String, String> para = new HashMap<String, String>();
para.put("uuid", envManager.getUUID());
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);
if (timeout != -1) {
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);
}
}
}
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
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) {
if (titlePane.getParent() == null) { // 如果处于隐藏状态,则让其显示
// this.add(titlePane, BorderLayout.NORTH);
if (cellElementEditPane.getParent() == null) { // 如果处于隐藏状态,则让其显示
this.add(cellElementEditPane, BorderLayout.CENTER);
}
cellElementEditPane.populate(ePane);
@ -151,7 +150,7 @@ public class CellElementPropertyPane extends DockingView {
@Override
public String getViewTitle() {
return Inter.getLocText("CellElement-Property_Table");
return Inter.getLocText("FR-Designer_CellElement_Property_Table");
}
@Override
@ -176,6 +175,7 @@ public class CellElementPropertyPane extends DockingView {
*/
public void GoToPane(String... id) {
cellElementEditPane.setSelectedIndex(id);
EastRegionContainerPane.getInstance().switchTabTo(EastRegionContainerPane.KEY_CELL_ATTR);
EastRegionContainerPane.getInstance().setWindow2PreferWidth();
}

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

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

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

@ -3,34 +3,7 @@
*/
package com.fr.design.mainframe;
import java.awt.AWTEvent;
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.base.*;
import com.fr.design.DesignState;
import com.fr.design.DesignerEnvManager;
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.cell.BorderAction;
import com.fr.design.actions.cell.CleanAuthorityAction;
import com.fr.design.actions.cell.style.AlignmentAction;
import com.fr.design.actions.cell.style.ReportFontBoldAction;
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.cell.style.*;
import com.fr.design.actions.columnrow.*;
import com.fr.design.actions.core.ActionFactory;
import com.fr.design.actions.edit.CopyAction;
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.FloatElementsClip;
import com.fr.design.cell.editor.*;
import com.fr.design.cell.editor.CellEditor;
import com.fr.design.constants.UIConstants;
import com.fr.design.designer.EditingState;
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.mainframe.cell.QuickEditorRegion;
import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus;
import com.fr.design.menu.KeySetUtils;
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.menu.*;
import com.fr.design.selection.QuickEditor;
import com.fr.design.selection.Selectedable;
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.FRLogger;
import com.fr.general.Inter;
import com.fr.grid.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.*;
import com.fr.grid.dnd.ElementCasePaneDropTarget;
import com.fr.grid.selection.CellSelection;
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.stable.ArrayUtils;
import com.fr.stable.ColumnRow;
import com.fr.stable.Constants;
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;
/**
@ -186,7 +138,7 @@ public abstract class ElementCasePane<T extends TemplateElementCase> extends Tar
/**
* Constructor.
*/
public ElementCasePane(T t) {
public ElementCasePane(T t) {
super(t);
// marks:能触发processEvent,不管是否给component增加listener。这里是使在reportPane中的任意位置滑动鼠标轮都能
// 下拉grid。
@ -209,7 +161,7 @@ public abstract class ElementCasePane<T extends TemplateElementCase> extends Tar
this.setLayout(new RGridLayout());
//todo 直接修改分辨率
if (this.resolution == 0){
if (this.resolution == 0) {
this.resolution = ScreenResolution.getScreenResolution();
}
@ -243,7 +195,6 @@ public abstract class ElementCasePane<T extends TemplateElementCase> extends Tar
}
public int getMenuState() {
return DesignState.WORK_SHEET;
}
@ -294,8 +245,8 @@ public abstract class ElementCasePane<T extends TemplateElementCase> extends Tar
setFormatState(DesignerContext.FORMAT_STATE_NULL);
formatBrush.setSelected(false);
grid.setCursor(UIConstants.CELL_DEFAULT_CURSOR);
if(DesignerContext.getReferencedElementCasePane() == null){
return;
if (DesignerContext.getReferencedElementCasePane() == null) {
return;
}
((ElementCasePane) DesignerContext.getReferencedElementCasePane()).getGrid().setNotShowingTableSelectPane(true);
@ -348,11 +299,11 @@ public abstract class ElementCasePane<T extends TemplateElementCase> extends Tar
}
public void setResolution(int resolution){
public void setResolution(int resolution) {
this.resolution = resolution;
}
public int getResolution(){
public int getResolution() {
return this.resolution;
}
@ -371,7 +322,7 @@ public abstract class ElementCasePane<T extends TemplateElementCase> extends Tar
private void initDefaultEditors() {
Grid grid = this.getGrid();
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(BiasTextPainter.class, new BiasTextPainterCellEditor(this));
@ -1150,7 +1101,7 @@ public abstract class ElementCasePane<T extends TemplateElementCase> extends Tar
HeadColumnAction headcolumnAction = new HeadColumnAction(this);
FootColumnAction footcolumnAction = new FootColumnAction(this);
ColumnRow selectedCellPoint = GridUtils.getAdjustEventColumnRow_withresolution(this, evt.getX(), evt.getY(),this.resolution);
ColumnRow selectedCellPoint = GridUtils.getAdjustEventColumnRow_withresolution(this, evt.getX(), evt.getY(), this.resolution);
ElementCase elementCase = this.getEditingElementCase();
boolean cancel = false;
ReportPageAttrProvider reportPageAttr = elementCase.getReportPageAttr();
@ -1268,11 +1219,7 @@ public abstract class ElementCasePane<T extends TemplateElementCase> extends Tar
protected ToolBarDef createAlignmentToolBar() {
return ShortCut.asToolBarDef(new ShortCut[]{
new AlignmentAction(this, new Icon[]{
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})}
new AlignmentAction(this)}
);
}
@ -1325,7 +1272,7 @@ public abstract class ElementCasePane<T extends TemplateElementCase> extends Tar
* @return 返回正在编辑的状态.
*/
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) {
@ -1341,15 +1288,18 @@ public abstract class ElementCasePane<T extends TemplateElementCase> extends Tar
protected Selection selection;
protected int verticalValue = 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 {
this.selection = selection.clone();
this.resolution = resolution;
} catch (CloneNotSupportedException e) {
throw new RuntimeException(e);
}
this.verticalValue = verticalValue;
this.horizontalValue = horizontalValue;
this.resolution = resolution;
}
@Override
@ -1363,7 +1313,8 @@ public abstract class ElementCasePane<T extends TemplateElementCase> extends Tar
ElementCasePane.this.getVerticalScrollBar().setValue(this.verticalValue);
ElementCasePane.this.getHorizontalScrollBar().setValue(this.horizontalValue);
// ElementCasePane.this.setResolution(this.resolution);
HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().setScale(this.resolution);
// 重绘.
ElementCasePane.this.repaint();
}

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

@ -1,6 +1,7 @@
package com.fr.design.mainframe;
import com.fr.base.BaseUtils;
import com.fr.design.actions.edit.HyperlinkAction;
import com.fr.design.fun.MenuHandler;
import com.fr.design.gui.frpane.HyperlinkGroupPane;
import com.fr.design.menu.KeySetUtils;
@ -44,58 +45,72 @@ public class ElementCasePaneDelegate extends ElementCasePane<WorkSheet> {
public ElementCasePaneDelegate(WorkSheet sheet) {
super(sheet);
this.addSelectionChangeListener(new SelectionListener() {
@Override
public void selectionChanged(SelectionEvent e) {
//在编辑权限,所以要更新权限编辑面板
if (BaseUtils.isAuthorityEditing()) {
AuthorityPropertyPane authorityPropertyPane = new AuthorityPropertyPane(ElementCasePaneDelegate.this);
authorityPropertyPane.populate();
EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.AUTHORITY_EDITION);
EastRegionContainerPane.getInstance().replaceAuthorityEditionPane(authorityPropertyPane);
EastRegionContainerPane.getInstance().replaceConfiguredRolesPane(RolesAlreadyEditedPane.getInstance());
if (!isEditable() && !BaseUtils.isAuthorityEditing()) {
return;
}
CellWidgetPropertyPane.getInstance().populate(ElementCasePaneDelegate.this);
CellElementPropertyPane.getInstance().populate(ElementCasePaneDelegate.this);
QuickEditorRegion.getInstance().populate(getCurrentEditor());
JTemplate editingTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
if (editingTemplate != null && !editingTemplate.isUpMode()) {
Selection editingSelection = ((ElementCasePaneDelegate)e.getSource()).getSelection();
// 模板初始化完成后,才能初始化超级链接面板
HyperlinkGroupPane hyperlinkGroupPane = editingTemplate.getHyperLinkPane(HyperlinkGroupPaneActionImpl.getInstance());
hyperlinkGroupPane.populate(ElementCasePaneDelegate.this);
if (editingSelection instanceof FloatSelection) {
EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.REPORT_FLOAT);
JPanel floatPane = new JPanel(new BorderLayout());
floatPane.add(ReportFloatPane.getInstance(), BorderLayout.NORTH);
floatPane.add(QuickEditorRegion.getInstance(), BorderLayout.CENTER);
EastRegionContainerPane.getInstance().replaceFloatElementPane(floatPane);
} else {
// 条件属性
ConditionAttributesGroupPane conditionAttributesGroupPane = ConditionAttributesGroupPane.getInstance();
conditionAttributesGroupPane.populate(ElementCasePaneDelegate.this);
EastRegionContainerPane.getInstance().replaceFloatElementPane(ReportFloatPane.getInstance());
EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.REPORT);
EastRegionContainerPane.getInstance().replaceCellAttrPane(CellElementPropertyPane.getInstance());
EastRegionContainerPane.getInstance().replaceCellElementPane(QuickEditorRegion.getInstance());
EastRegionContainerPane.getInstance().replaceConditionAttrPane(conditionAttributesGroupPane);
EastRegionContainerPane.getInstance().replaceWidgetSettingsPane(CellWidgetPropertyPane.getInstance());
}
EastRegionContainerPane.getInstance().replaceHyperlinkPane(hyperlinkGroupPane);
EastRegionContainerPane.getInstance().removeParameterPane();
}
refreshPropertyPanes();
}
});
this.addTargetModifiedListener(new TargetModifiedListener() {
@Override
public void targetModified(TargetModifiedEvent e) {
CellElementPropertyPane.getInstance().populate(ElementCasePaneDelegate.this);
if (DesignerContext.isRefreshOnTargetModifiedEnabled()) {
refreshPropertyPanes();
} else {
CellElementPropertyPane.getInstance().populate(ElementCasePaneDelegate.this);
}
}
});
}
private void refreshPropertyPanes() {
//在编辑权限,所以要更新权限编辑面板
if (BaseUtils.isAuthorityEditing()) {
AuthorityPropertyPane authorityPropertyPane = new AuthorityPropertyPane(ElementCasePaneDelegate.this);
authorityPropertyPane.populate();
EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.AUTHORITY_EDITION);
EastRegionContainerPane.getInstance().replaceAuthorityEditionPane(authorityPropertyPane);
EastRegionContainerPane.getInstance().replaceConfiguredRolesPane(RolesAlreadyEditedPane.getInstance());
return;
}
if (DesignerContext.getDesignerFrame().getSelectedJTemplate() != null) {
CellWidgetPropertyPane.getInstance().populate(ElementCasePaneDelegate.this);
}
CellElementPropertyPane.getInstance().populate(ElementCasePaneDelegate.this);
QuickEditorRegion.getInstance().populate(getCurrentEditor());
JTemplate editingTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
if (editingTemplate != null && !editingTemplate.isUpMode()) {
Selection editingSelection = getSelection();
// 模板初始化完成后,才能初始化超级链接面板
HyperlinkGroupPane hyperlinkGroupPane = editingTemplate.getHyperLinkPane(HyperlinkGroupPaneActionImpl.getInstance());
hyperlinkGroupPane.populate(ElementCasePaneDelegate.this);
if (editingSelection instanceof FloatSelection) {
EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.REPORT_FLOAT);
JPanel floatPane = new JPanel(new BorderLayout());
floatPane.add(ReportFloatPane.getInstance(), BorderLayout.NORTH);
floatPane.add(QuickEditorRegion.getInstance(), BorderLayout.CENTER);
EastRegionContainerPane.getInstance().replaceFloatElementPane(floatPane);
} else {
// 条件属性
ConditionAttributesGroupPane conditionAttributesGroupPane = ConditionAttributesGroupPane.getInstance();
conditionAttributesGroupPane.populate(ElementCasePaneDelegate.this);
EastRegionContainerPane.getInstance().replaceFloatElementPane(ReportFloatPane.getInstance());
EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.REPORT);
EastRegionContainerPane.getInstance().replaceCellAttrPane(CellElementPropertyPane.getInstance());
EastRegionContainerPane.getInstance().replaceCellElementPane(QuickEditorRegion.getInstance());
EastRegionContainerPane.getInstance().replaceConditionAttrPane(conditionAttributesGroupPane);
EastRegionContainerPane.getInstance().replaceWidgetSettingsPane(CellWidgetPropertyPane.getInstance());
EastRegionContainerPane.getInstance().updateCellElementState(isSelectedOneCell());
}
EastRegionContainerPane.getInstance().replaceHyperlinkPane(hyperlinkGroupPane);
EastRegionContainerPane.getInstance().removeParameterPane();
}
}
@Override
protected boolean supportRepeatedHeaderFooter() {
return true;
@ -122,6 +137,7 @@ public class ElementCasePaneDelegate extends ElementCasePane<WorkSheet> {
*
* @return 不是必须在可见范围.
*/
@Override
public boolean mustInVisibleRange() {
return false;
}
@ -162,6 +178,9 @@ public class ElementCasePaneDelegate extends ElementCasePane<WorkSheet> {
for (int i = 0; i < actions.length; 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.addShortCut(new CellExpandAttrAction());
menuDef.addShortCut(new CellWidgetAttrAction(this));
menuDef.addShortCut(new GlobalStyleMenuDef(this));
// 单元格形态
menuDef.addShortCut(DeprecatedActionManager.getPresentMenu(this));
menuDef.addShortCut(new CellWidgetAttrAction());
menuDef.addShortCut(new ConditionAttributesAction());
menuDef.addShortCut(new HyperlinkAction());
menuDef.addShortCut(SeparatorDef.DEFAULT);
menuDef.addShortCut(new MergeCellAction(this));
menuDef.addShortCut(new UnmergeCellAction(this));

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

@ -3,6 +3,7 @@
*/
package com.fr.design.mainframe;
import com.fr.base.ConfigManagerFactory;
import com.fr.base.FRContext;
import com.fr.data.core.db.DBUtils;
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.mainframe.errorinfo.ErrorInfoUploader;
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.json.JSONArray;
import com.fr.json.JSONException;
import com.fr.record.DBRecordManager;
import com.fr.stable.*;
import com.fr.stable.xml.*;
import com.fr.json.JSONObject;
import com.fr.record.DBRecordXManager;
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 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.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
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
@ -125,19 +154,23 @@ public class InformationCollector implements XMLReadable, XMLWriter {
JSONArray startStopArray = new JSONArray();
for (int i = 0; i < startStop.size(); i++) {
JSONObject jo = new JSONObject();
jo.put(ATTR_START, startStop.get(i).getStartDate());
jo.put(ATTR_STOP, startStop.get(i).getStopDate());
startStopArray.put(jo);
try {
jo.put(ATTR_START, startStop.get(i).getStartDate());
jo.put(ATTR_STOP, startStop.get(i).getStopDate());
startStopArray.put(jo);
DesignerEnvManager envManager = DesignerEnvManager.getEnvManager();
content.put(XML_START_STOP, startStopArray);
content.put(XML_UUID, envManager.getUUID());
content.put(XML_JAR, GeneralUtils.readBuildNO());
content.put(XML_VERSION, ProductConstants.RELEASE_VERSION);
content.put(XML_USERNAME, ConfigManagerFactory.getProviderInstance().getBbsUsername());
content.put(XML_KEY, envManager.getActivationKey());
content.put(XML_OS, System.getProperty("os.name"));
} catch (JSONException e) {
FRContext.getLogger().error(e.getMessage(), e);
}
}
DesignerEnvManager envManager = DesignerEnvManager.getEnvManager();
content.put(XML_START_STOP, startStopArray);
content.put(XML_UUID, envManager.getUUID());
content.put(XML_JAR, GeneralUtils.readBuildNO());
content.put(XML_VERSION, ProductConstants.RELEASE_VERSION);
content.put(XML_USERNAME, envManager.getBBSName());
content.put(XML_KEY, envManager.getActivationKey());
content.put(XML_OS, System.getProperty("os.name"));
try {
return content.toString().getBytes(EncodeConstants.ENCODING_UTF_8);
} catch (UnsupportedEncodingException e) {
@ -161,7 +194,12 @@ public class InformationCollector implements XMLReadable, XMLWriter {
}
String res = hc.getResponseText();
//服务器返回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){
this.reset();
}
@ -179,7 +217,7 @@ public class InformationCollector implements XMLReadable, XMLWriter {
Table table = new Table(TABLE_NAME);
try {
conn = DBRecordManager.getDB().createConnection();
conn = DBRecordXManager.getDB().createConnection();
ResultSet rs = selectAllFromLogDB(conn, table);
if(rs == null){
@ -201,8 +239,13 @@ public class InformationCollector implements XMLReadable, XMLWriter {
}
String res = httpClient.getResponseText();
boolean success = ComparatorUtils.equals(new JSONObject(res).get("status"), "success");
//服务器返回true, 说明已经获取成功, 清空当前记录的信息
boolean success = false;
try {
success = ComparatorUtils.equals(new JSONObject(res).get("status"), "success");
} catch (JSONException e) {
FRContext.getLogger().error(e.getMessage(), e);
}
//服务器返回true, 说明已经获取成功, 清空当前记录的信息
if (success) {
deleteLogDB(conn, table);
}
@ -211,7 +254,7 @@ public class InformationCollector implements XMLReadable, XMLWriter {
private void deleteLogDB(Connection conn, Table table) {
try {
conn = DBRecordManager.getDB().createConnection();
conn = DBRecordXManager.getDB().createConnection();
Delete delete = new Delete(table);
delete.execute(conn);
} catch (Exception e) {
@ -254,7 +297,7 @@ public class InformationCollector implements XMLReadable, XMLWriter {
}
DesignerEnvManager envManager = DesignerEnvManager.getEnvManager();
content.put("username", envManager.getBBSName());
content.put("username", ConfigManagerFactory.getProviderInstance().getBbsUsername());
content.put("uuid", envManager.getUUID());
content.put("functions", functionArray);

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

@ -92,7 +92,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
private UIModeControlContainer centerPane;
public ReportComponentComposite reportComposite;
private ParameterDefinitePane parameterPane;
private int resolution;
private int resolution = ScreenResolution.getScreenResolution();
public JWorkBook() {
super(new WorkBook(new WorkSheet()), "WorkBook");
@ -114,10 +114,13 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
if (isEditingPolySheet()) {
EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.POLY);
} else {
EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.REPORT);
EastRegionContainerPane.getInstance().replaceCellElementPane(getEastUpPane());
EastRegionContainerPane.getInstance().replaceCellAttrPane(getEastDownPane());
if (isUpMode()) {
EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.REPORT_PARA);
} else {
EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.REPORT);
}
}
refreshToolArea();
}
private boolean isEditingPolySheet() {
@ -129,6 +132,11 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
return getEditingElementCasePane();
}
@Override
public JComponent getCurrentReportComponentPane() {
return reportComposite;
}
@Override
protected UIModeControlContainer createCenterPane() {
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);
polyDezi.updateUI();
}
HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().fireTargetModified();
}
@Override
@ -854,6 +861,11 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
return ReportHyperlinkGroupPane.getInstance(hyperlinkGroupPaneActionProvider);
}
@Override
public HyperlinkGroupPane getHyperLinkPaneNoPop(HyperlinkGroupPaneActionProvider hyperlinkGroupPaneActionProvider) {
return ReportHyperlinkGroupPaneNoPop.getInstance(hyperlinkGroupPaneActionProvider);
}
public void setAuthorityMode(boolean 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();
/**
* 更新JSliderPane
*/
public abstract void updateJSliderValue();
@Override
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.ScreenResolution;
import com.fr.common.inputevent.InputEventBaseOnOS;
import com.fr.design.designer.EditingState;
import com.fr.design.event.TargetModifiedListener;
import com.fr.design.file.HistoryTemplateListPane;
@ -11,6 +12,7 @@ import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.general.Inter;
import com.fr.grid.Grid;
import com.fr.main.impl.WorkBook;
import com.fr.poly.PolyDesigner;
import com.fr.report.report.TemplateReport;
import javax.swing.*;
@ -31,6 +33,7 @@ public class ReportComponentComposite extends JComponent {
private static final int MAX = 400;
private static final int HUND = 100;
private static final int MIN = 10;
private static final int DIR = 15;
private JWorkBook parent;
private UIModeControlContainer parentContainer = null;
@ -45,9 +48,6 @@ public class ReportComponentComposite extends JComponent {
private JSliderPane jSliderContainer;
private boolean isCtrl = false;
/**
* Constructor with workbook..
*/
@ -66,32 +66,13 @@ public class ReportComponentComposite extends JComponent {
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() {
@Override
public void mouseWheelMoved(MouseWheelEvent e) {
if (isCtrl) {
if (InputEventBaseOnOS.isControlDown(e)) {
int dir = e.getWheelRotation();
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;
}
centerCardPane.populate(workbook.getTemplateReport(newIndex));
if (parentContainer != null) {
parentContainer.setDownPane(ReportComponentComposite.this);
}
@ -140,27 +120,35 @@ public class ReportComponentComposite extends JComponent {
EditingState reportPaneEditState = templateStateList.get(newIndex);
if (reportPaneEditState != null) {
reportPaneEditState.revert();
updateJSlider();
}
} else {
while (templateStateList.size() <= newIndex) {
templateStateList.add(null);
}
centerCardPane.editingComponet.setSelection(centerCardPane.editingComponet.getDefaultSelectElement());
if (jSliderContainer != null){
jSliderContainer.reset();
}
}
if (centerCardPane.editingComponet.elementCasePane == null) {
centerCardPane.getPolyDezi().polyArea.addMouseWheelListener(showValSpinnerMouseWheelListener);
return;
}
Grid grid = centerCardPane.editingComponet.elementCasePane.getGrid();
this.centerCardPane.editingComponet.elementCasePane.getGrid().addMouseWheelListener(showValSpinnerMouseWheelListener);
this.centerCardPane.editingComponet.elementCasePane.getGrid().addKeyListener(showValSpinnerKeyListener);
if (!grid.hasFocus() && grid.isRequestFocusEnabled()) {
grid.requestFocus();
}
}
private void updateJSlider(){
centerCardPane.editingComponet.updateJSliderValue();
}
/**
* 移除选中状态
*
@ -224,19 +212,14 @@ public class ReportComponentComposite extends JComponent {
}
private JComponent createSouthControlPane() {
// hbarContainer = FRGUIPaneFactory.createBorderLayout_S_Pane();
// hbarContainer.add(createSouthControlPaneWithJSliderPane());
hbarContainer = FRGUIPaneFactory.createBorderLayout_S_Pane();
hbarContainer.add(centerCardPane.editingComponet.getHorizontalScrollBar());
// JSplitPane splitpane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, sheetNameTab, hbarContainer);
JPanel southPane = new JPanel(new BorderLayout());
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(splitpane, BorderLayout.CENTER);
southPane.add(sheetNameTab, BorderLayout.CENTER);
southPane.add(jSliderContainer, BorderLayout.EAST);
return southPane;
}

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

@ -23,7 +23,6 @@ import java.awt.*;
public class ReportFloatPane extends JPanel {
private static ReportFloatPane THIS;
private ElementCasePaneDelegate elementCasePaneDelegate;
private MenuDef insertFloatMenu;
private ReportFloatPane() {
@ -37,12 +36,20 @@ public class ReportFloatPane extends JPanel {
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() {
this.setLayout(new BorderLayout());
UIToolbar topToolBar = new UIToolbar();
topToolBar.setLayout(new BorderLayout());
insertFloatMenu = createInsertToolBar();
initInsertToolBar();
topToolBar.setPreferredSize(new Dimension(155,20));
topToolBar.add(createButtonUI(), BorderLayout.CENTER);
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},
};
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);
}
private MenuDef createInsertToolBar() {
MenuDef insertFloatMenu = new MenuDef();
private void initInsertToolBar() {
insertFloatMenu = new MenuDef(true);
insertFloatMenu.setName(KeySetUtils.INSERT_FLOAT.getMenuKeySetName());
insertFloatMenu.setTooltip(Inter.getLocText("FR-Designer_T_Insert_Float"));
insertFloatMenu.setIconPath("com/fr/design/images/control/addPopup.png");
JTemplate editingTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
elementCasePaneDelegate = (ElementCasePaneDelegate) editingTemplate.getCurrentElementCasePane();
UpdateAction[] actions = ActionFactory.createFloatInsertAction(ElementCasePane.class, elementCasePaneDelegate);
for (int i = 0; i < actions.length; i++) {
insertFloatMenu.addShortCut(actions[i]);
JComponent currentElementCasePane = editingTemplate.getCurrentElementCasePane();
if (currentElementCasePane != null) {
insertFloatMenu.clearShortCuts();
UpdateAction[] actions = ActionFactory.createFloatInsertAction(ElementCasePane.class, currentElementCasePane);
for (int i = 0; i < actions.length; i++) {
insertFloatMenu.addShortCut(actions[i]);
}
}
return insertFloatMenu;
}
private UIButton createButtonUI() {

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

@ -23,7 +23,8 @@ import java.awt.*;
public class ReportHyperlinkGroupPane extends HyperlinkGroupPane {
private static ReportHyperlinkGroupPane singleton;
private ReportHyperlinkGroupPane(HyperlinkGroupPaneActionProvider hyperlinkGroupPaneActionProvider) {
// 仅供继承使用,外部通过 getInstance 获取实例
protected ReportHyperlinkGroupPane(HyperlinkGroupPaneActionProvider hyperlinkGroupPaneActionProvider) {
super(hyperlinkGroupPaneActionProvider);
}
@ -35,7 +36,7 @@ public class ReportHyperlinkGroupPane extends HyperlinkGroupPane {
return singleton;
}
private void refreshPane() {
protected void refreshPane() {
ElementCasePane reportPane = ((JWorkBook)HistoryTemplateListPane.getInstance().getCurrentEditingTemplate()).getEditingElementCasePane();
if (reportPane == null) {
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.file.HistoryTemplateListPane;
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.SeparatorDef;
import com.fr.design.roleAuthority.ReportAndFSManagePane;
import com.fr.design.roleAuthority.RolesAlreadyEditedPane;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.design.utils.gui.GUIPaintUtils;
import com.fr.general.ComparatorUtils;
import com.fr.general.Inter;
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 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 Icon LEFT_ICON = BaseUtils.createIcon(DESIGN_IMAGE, 0, 0, 14, 14);
private static final Icon RIGHT_ICON = BaseUtils.createIcon(DESIGN_IMAGE, 14, 0, 14, 14);
private static final Icon DISABLED_LEFT_ICON = BaseUtils.createIcon(DESIGN_IMAGE, 0, 14, 14, 14);
private static final Icon DISABLED_RIGHT_ICON = BaseUtils.createIcon(DESIGN_IMAGE, 14, 14, 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.readIcon("com/fr/design/images/sheet/right_normal@1x.png");
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.readIcon("com/fr/design/images/sheet/right_hover@1x.png");
private static final int ICON_SEP_DISTANCE = 8;
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);
}
};
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.setDisabledIcon(DISABLED_LEFT_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);
}
};
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.setDisabledIcon(DISABLED_RIGHT_ICON);
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);
// peter:画字符
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
*/
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];
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};
@ -554,10 +580,12 @@ public class SheetNameTabPane extends JComponent implements MouseListener, Mouse
for (int i = scrollIndex; i <= lastOneIndex; i++) {
int textWidth = widthArray[i];
if (evtX >= textX && evtX < textX + textWidth) {
if (getSelectedIndex() != i) {
boolean needRefreshPropertiesPane = getSelectedIndex() != i;
setSelectedIndex(i);
if (needRefreshPropertiesPane) {
HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().refreshEastPropertiesPane();
}
setSelectedIndex(i);
isBlank = false;
reportComposite.setComposite();
if (isAuthorityEditing) {

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

@ -4,11 +4,13 @@ import java.awt.BorderLayout;
import javax.swing.*;
import com.fr.base.ScreenResolution;
import com.fr.design.DesignState;
import com.fr.design.actions.report.*;
import com.fr.design.designer.EditingState;
import com.fr.design.event.TargetModifiedEvent;
import com.fr.design.event.TargetModifiedListener;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.menu.*;
import com.fr.grid.selection.CellSelection;
@ -21,6 +23,8 @@ import com.fr.stable.ArrayUtils;
public class WorkSheetDesigner extends ReportComponent<WorkSheet, ElementCasePaneDelegate, Selection> {
private static final int HUND = 100;
public WorkSheetDesigner(WorkSheet 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());
}
@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
public void addSelectionChangeListener(SelectionListener 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 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_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.
*/
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"));
private static AlphaFineDialog alphaFineDialog;
@ -27,6 +26,9 @@ public class AlphaFineHelper {
* 弹出alphafine搜索面板
*/
public static void showAlphaFineDialog(boolean forceOpen) {
if (!AlphaFineConfigManager.isALPHALicAvailable()) {
return;
}
if (alphaFineDialog == null) {
alphaFineDialog = new AlphaFineDialog(DesignerContext.getDesignerFrame(), forceOpen);
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;
import com.fr.design.actions.UpdateAction;
import com.fr.design.mainframe.alphafine.CellType;
import com.fr.general.FRLogger;
import com.fr.json.JSONException;
import com.fr.json.JSONObject;
import javax.swing.*;
/**
* Created by XiaXiang on 2017/4/20.
*/
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);
setSearchCount(searchCount);
}
public ActionModel(String name, String description, Action action) {
public ActionModel(String name, String description, UpdateAction action) {
super(name, null, CellType.ACTION);
this.action = action;
this.setDescription(description);
@ -43,11 +42,11 @@ public class ActionModel extends AlphaCellModel {
return action != null ? action.hashCode() : 0;
}
public Action getAction() {
public UpdateAction getAction() {
return action;
}
public void setAction(Action action) {
public void setAction(UpdateAction action) {
this.action = action;
}

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

@ -27,7 +27,7 @@ public abstract class AlphaCellModel implements Comparable {
this.content = content;
}
public CellType getType() {
return type;
}
@ -68,6 +68,7 @@ public abstract class AlphaCellModel implements Comparable {
public boolean isNeedToSendToServer() {
return true;
}
/**
* model转json
*
@ -102,7 +103,7 @@ public abstract class AlphaCellModel implements Comparable {
@Override
public int compareTo(Object o) {
AlphaCellModel cellModel = (AlphaCellModel)o;
AlphaCellModel cellModel = (AlphaCellModel) o;
int difference = cellModel.getSearchCount() - this.getSearchCount();
if (difference != 0) {
return difference;

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

@ -1,10 +1,10 @@
package com.fr.design.mainframe.alphafine.cell.render;
import com.bulenkov.iconloader.IconLoader;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.mainframe.alphafine.AlphaFineConstants;
import com.fr.design.mainframe.alphafine.cell.model.AlphaCellModel;
import com.fr.design.mainframe.alphafine.cell.model.MoreModel;
import com.fr.general.IOUtils;
import com.fr.stable.StringUtils;
import javax.swing.*;
@ -15,6 +15,9 @@ import java.awt.*;
*/
public class ContentCellRender implements ListCellRenderer<Object> {
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
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());
if (model.hasAction()) {
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);
titleLabel.setForeground(Color.WHITE);
titleLabel.setIcon(new ImageIcon(IOUtils.readImage(iconUrl)));
titleLabel.setIcon(IconLoader.getIcon(iconUrl));
} else {
String iconUrl = "/com/fr/design/mainframe/alphafine/images/alphafine" + model.getType().getTypeValue() + ".png";
titleLabel.setIcon(new ImageIcon(IOUtils.readImage(iconUrl)));
String iconUrl = CELL_PATH + model.getType().getTypeValue() + SUFFIX;
titleLabel.setIcon(IconLoader.getIcon(iconUrl));
titleLabel.setForeground(AlphaFineConstants.BLACK);
}
@ -51,7 +54,7 @@ public class ContentCellRender implements ListCellRenderer<Object> {
detailLabel.setForeground(AlphaFineConstants.LIGHT_GRAY);
panel.add(detailLabel, BorderLayout.CENTER);
int width = (int) (titleLabel.getPreferredSize().getWidth() + detailLabel.getPreferredSize().getWidth());
if ( width > AlphaFineConstants.LEFT_WIDTH - OFFSET) {
if (width > AlphaFineConstants.LEFT_WIDTH - OFFSET) {
int nameWidth = (int) (AlphaFineConstants.LEFT_WIDTH - detailLabel.getPreferredSize().getWidth() - OFFSET);
titleLabel.setPreferredSize(new Dimension(nameWidth, AlphaFineConstants.CELL_HEIGHT));
}

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.mainframe.alphafine.AlphaFineConstants;
import com.fr.design.mainframe.alphafine.cell.model.MoreModel;
import com.fr.general.IOUtils;
import javax.swing.*;
import java.awt.*;
@ -33,14 +32,6 @@ public class TitleCellRender implements ListCellRenderer<Object> {
showMoreLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 10));
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));
return panel;
}

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

@ -1,7 +1,10 @@
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.design.DesignerEnvManager;
import com.fr.design.actions.help.alphafine.AlphaFineConfigManager;
import com.fr.design.dialog.UIDialog;
import com.fr.design.gui.ibutton.UIButton;
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.listener.DocumentAdapter;
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.FilePreviewPane;
import com.fr.design.mainframe.alphafine.preview.NoResultPane;
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.FormIO;
import com.fr.general.ComparatorUtils;
@ -42,7 +50,13 @@ import javax.swing.event.DocumentEvent;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
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.io.IOException;
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 = "k:shop ";
private static final String PLACE_HOLDER = Inter.getLocText("FR-Designer_AlphaFine");
private static final int MAX_SHOW_SIZE = 12;
private AlphaFineTextField searchTextField;
private UIButton closeButton;
private JPanel searchResultPane;
private Point pressedPoint;
private UIScrollPane leftSearchResultPane;
private JPanel defaultPane;
//分割线
private UILabel splitLabel;
private JPanel rightSearchResultPane;
private AlphaFineList searchResultList;
private SearchListModel searchListModel;
@ -84,7 +102,6 @@ public class AlphaFineDialog extends UIDialog {
//是否强制打开,因为面板是否关闭绑定了全局鼠标事件,这里需要处理一下
private boolean forceOpen;
public AlphaFineDialog(Frame parent, boolean forceOpen) {
super(parent);
this.forceOpen = forceOpen;
@ -107,7 +124,7 @@ public class AlphaFineDialog extends UIDialog {
KeyEvent e = (KeyEvent) event;
KeyStroke keyStroke = (KeyStroke) KeyStroke.getAWTKeyStrokeForEvent(e);
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();
}
@ -129,7 +146,7 @@ public class AlphaFineDialog extends UIDialog {
private void initComponents() {
initSearchTextField();
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.setOpaque(true);
iconLabel.setBackground(Color.WHITE);
@ -144,7 +161,7 @@ public class AlphaFineDialog extends UIDialog {
}
};
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.setBorderPainted(false);
closeButton.setRolloverEnabled(false);
@ -156,12 +173,6 @@ public class AlphaFineDialog extends UIDialog {
});
topPane.add(closeButton, BorderLayout.EAST);
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() {
searchTextField = new AlphaFineTextField(PLACE_HOLDER);
initTextFieldKeyListener();
initTextFieldListener();
searchTextField.setFont(AlphaFineConstants.GREATER_FONT);
searchTextField.setBackground(Color.WHITE);
searchTextField.setBorderPainted(false);
@ -223,16 +234,11 @@ public class AlphaFineDialog extends UIDialog {
* @param text
*/
private void doSearch(String text) {
if (StringUtils.isBlank(text) || isNeedSearch(text)) {
removeSearchResult();
} else {
showSearchResult();
}
showSearchResult(text);
}
boolean isNeedSearch(String text) {
return ComparatorUtils.equals(PLACE_HOLDER, text) || text.contains("'");
boolean isNoNeedSearch(String text) {
return ComparatorUtils.equals(PLACE_HOLDER, text) || text.contains("'") || StringUtils.isBlank(text);
}
@Override
@ -267,17 +273,17 @@ public class AlphaFineDialog extends UIDialog {
searchResultPane = null;
}
setSize(AlphaFineConstants.FIELD_SIZE);
repaint();
refreshContainer();
}
/**
* 展示搜索结果
*/
private void showSearchResult() {
private void showSearchResult(String text) {
if (searchResultPane == null) {
initSearchResultComponents();
}
initSearchWorker();
initSearchWorker(text);
}
/**
@ -294,20 +300,15 @@ public class AlphaFineDialog extends UIDialog {
searchResultList.setCellRenderer(new ContentCellRender());
leftSearchResultPane = new UIScrollPane(searchResultList);
leftSearchResultPane.setBorder(null);
leftSearchResultPane.setBackground(Color.WHITE);
leftSearchResultPane.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
leftSearchResultPane.setPreferredSize(new Dimension(AlphaFineConstants.LEFT_WIDTH, AlphaFineConstants.CONTENT_HEIGHT));
rightSearchResultPane = new JPanel();
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));
searchResultPane.add(leftSearchResultPane, BorderLayout.WEST);
searchResultPane.add(splitLine, BorderLayout.CENTER);
searchResultPane.add(rightSearchResultPane, BorderLayout.EAST);
UILabel splitLabel = new UILabel();
splitLabel.setBackground(AlphaFineConstants.GRAY);
splitLabel = new UILabel();
splitLabel.setPreferredSize(new Dimension(AlphaFineConstants.HEIGHT, 1));
searchResultPane.add(splitLabel, BorderLayout.NORTH);
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()) {
this.searchWorker.cancel(true);
this.searchWorker = null;
@ -325,13 +326,14 @@ public class AlphaFineDialog extends UIDialog {
this.searchWorker = new SwingWorker() {
@Override
protected Object doInBackground() throws Exception {
rebuildList(searchTextField.getText().toLowerCase());
rebuildList(text);
return null;
}
@Override
protected void done() {
if (!isCancelled()) {
splitLabel.setIcon(null);
fireStopLoading();
}
}
@ -339,11 +341,45 @@ public class AlphaFineDialog extends UIDialog {
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() {
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) {
resetContainer();
if (searchText.startsWith(ADVANCED_SEARCH_MARK)) {
if (searchText.startsWith(ACTION_MARK_SHORT) || searchText.startsWith(ACTION_MARK)) {
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)) {
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)) {
storeText = searchText.substring(searchText.indexOf(StringUtils.BLANK) + 1, searchText.length());
getFileList(storeText);
buildFileList(storeText);
} else if (searchText.startsWith(CPT_MARK) || searchText.startsWith(FRM_MARK)) {
storeText = searchText.substring(searchText.indexOf(StringUtils.BLANK) + 1, searchText.length());
getFileList(searchText);
buildFileList(searchText);
} else if (searchText.startsWith(DS_MARK)) {
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)) {
storeText = searchText.substring(searchText.indexOf(StringUtils.BLANK) + 1, searchText.length());
getPluginList(storeText);
buildPluginList(storeText);
}
} else {
storeText = searchText.trim();
@ -385,11 +422,12 @@ public class AlphaFineDialog extends UIDialog {
* 重置面板
*/
private void resetContainer() {
rightSearchResultPane.removeAll();
splitLabel.setIcon(new ImageIcon(getClass().getResource("/com/fr/design/mainframe/alphafine/images/bigloading.gif")));
resumeLeftPane();
searchListModel.removeAllElements();
searchListModel.resetSelectedState();
rightSearchResultPane.removeAll();
validate();
repaint();
refreshContainer();
}
/**
@ -398,23 +436,22 @@ public class AlphaFineDialog extends UIDialog {
* @param searchText
*/
private void doNormalSearch(String searchText) {
getRecentList(searchText);
getRecommendList(searchText);
getActionList(searchText);
getFileList(searchText);
getDocumentList(searchText);
getPluginList(searchText);
buildRecentList(searchText);
buildRecommendList(searchText);
buildActionList(searchText);
buildFileList(searchText);
buildDocumentList(searchText);
buildPluginList(searchText);
}
private void getDocumentList(final String searchText) {
private void buildDocumentList(final String searchText) {
SearchResult documentModelList = DocumentSearchManager.getDocumentSearchManager().getLessSearchResult(searchText);
for (AlphaCellModel object : documentModelList) {
AlphaFineHelper.checkCancel();
searchListModel.addElement(object);
}
}
private void getFileList(final String searchText) {
private void buildFileList(final String searchText) {
SearchResult fileModelList = FileSearchManager.getFileSearchManager().getLessSearchResult(searchText);
for (AlphaCellModel object : fileModelList) {
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);
for (AlphaCellModel object : actionModelList) {
AlphaFineHelper.checkCancel();
searchListModel.addElement(object);
}
}
private void getPluginList(final String searchText) {
private void buildPluginList(final String searchText) {
SearchResult pluginModelList = PluginSearchManager.getPluginSearchManager().getLessSearchResult(searchText);
for (AlphaCellModel object : pluginModelList) {
AlphaFineHelper.checkCancel();
searchListModel.addElement(object);
}
}
private void getRecommendList(final String searchText) {
private void buildRecommendList(final String searchText) {
SearchResult recommendModelList = RecommendSearchManager.getRecommendSearchManager().getLessSearchResult(searchText);
for (AlphaCellModel object : recommendModelList) {
AlphaFineHelper.checkCancel();
searchListModel.addElement(object);
}
}
private void getRecentList(final String searchText) {
private void buildRecentList(final String searchText) {
SearchResult recentModelList = RecentSearchManager.getRecentSearchManger().getLessSearchResult(searchText);
for (AlphaCellModel object : recentModelList) {
AlphaFineHelper.checkCancel();
searchListModel.addElement(object);
}
@ -534,7 +567,7 @@ public class AlphaFineDialog extends UIDialog {
break;
case ACTION:
rightSearchResultPane.removeAll();
rightSearchResultPane.add(new ActionPreviewPane());
rightSearchResultPane.add(new NoResultPane(Inter.getLocText("FR-Designer_NoResult"), AlphaFineConstants.IMAGE_URL + "noresult.png"));
validate();
repaint();
break;
@ -584,7 +617,7 @@ public class AlphaFineDialog extends UIDialog {
this.showWorker.execute();
break;
default:
return;
rightSearchResultPane.removeAll();
}
@ -600,11 +633,10 @@ public class AlphaFineDialog extends UIDialog {
}
}
private void HandleMoreOrLessResult(int index, MoreModel selectedValue) {
if (selectedValue.getContent().equals(Inter.getLocText("FR-Designer_AlphaFine_ShowAll"))) {
private void dealWithMoreOrLessResult(int index, MoreModel selectedValue) {
if (ComparatorUtils.equals(Inter.getLocText("FR-Designer_AlphaFine_ShowAll"), selectedValue.getContent())) {
selectedValue.setContent(Inter.getLocText("FR-Designer_AlphaFine_ShowLess"));
rebuildShowMoreList(index, selectedValue);
} else {
selectedValue.setContent(Inter.getLocText("FR-Designer_AlphaFine_ShowAll"));
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")));
label.setBorder(BorderFactory.createEmptyBorder(120, 0, 0, 0));
rightSearchResultPane.add(label, BorderLayout.CENTER);
validate();
repaint();
refreshContainer();
}
/**
@ -625,34 +656,43 @@ public class AlphaFineDialog extends UIDialog {
*/
private void initGlobalListener() {
initAWTEventListener();
initMouseListener();
}
/**
* 为textfield添加键盘监听器
* 为textfield添加监听器
*/
private void initTextFieldKeyListener() {
private void initTextFieldListener() {
searchTextField.addKeyListener(new KeyAdapter() {
@Override
public void keyPressed(KeyEvent e) {
if (e.getKeyCode() == KeyEvent.VK_DOWN) {
searchResultList.requestFocus();
if (e.getKeyCode() == KeyEvent.VK_ENTER) {
if (searchResultList.getModel().getSize() > 1) {
dealWithSearchResult(searchResultList.getSelectedValue());
}
} else if (e.getKeyCode() == KeyEvent.VK_DOWN) {
if (searchResultList.getSelectedIndex() == searchResultList.getModel().getSize() - 1) {
searchResultList.setSelectedIndex(0);
}
searchResultList.setSelectedIndex(searchResultList.getSelectedIndex() + 1);
} else if (e.getKeyCode() == KeyEvent.VK_ENTER) {
doNavigate();
saveHistory(searchResultList.getSelectedValue());
}
} else if (e.getKeyCode() == KeyEvent.VK_UP) {
searchResultList.setSelectedIndex(searchResultList.getSelectedIndex() - 1);
} else escAlphaFineDialog(e);
}
});
searchTextField.getDocument().addDocumentListener(new DocumentAdapter() {
@Override
public void keyReleased(KeyEvent e) {
int keyCode = e.getKeyCode();
if (keyCode == KeyEvent.VK_ESCAPE) {
if (StringUtils.isBlank(searchTextField.getText()) || ComparatorUtils.equals(searchTextField.getText(), searchTextField.getPlaceHolder())) {
AlphaFineDialog.this.setVisible(false);
} else {
searchTextField.setText(null);
protected void textChanged(DocumentEvent e) {
if (isNoNeedSearch(searchTextField.getText())) {
removeSearchResult();
} else {
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() {
addMouseMotionListener(new MouseMotionAdapter() {
@Override
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);// 改变窗体位置
private void dealWithSearchResult(AlphaCellModel selectedValue) {
doNavigate();
saveLocalHistory(selectedValue);
}
/**
@ -727,25 +738,30 @@ public class AlphaFineDialog extends UIDialog {
@Override
public void checkValid() throws Exception {
//不处理
}
/**
* 导航到结果页面
*/
private void doNavigate() {
AlphaFineDialog.this.dispose();
final AlphaCellModel model = searchResultList.getSelectedValue();
model.doAction();
if (model != null) {
model.doAction();
}
}
/**
* 保存本地本地常用
* 保存结果到本地本地常用
*
* @param cellModel
*/
private void saveHistory(AlphaCellModel cellModel) {
private void saveLocalHistory(AlphaCellModel cellModel) {
RecentSearchManager recentSearchManager = RecentSearchManager.getRecentSearchManger();
recentSearchManager.addRecentModel(storeText, cellModel);
recentSearchManager.saveXMLFile();
sendToServer(storeText, cellModel);
sendDataToServer(storeText, cellModel);
}
@ -755,9 +771,9 @@ public class AlphaFineDialog extends UIDialog {
* @param searchKey
* @param cellModel
*/
private void sendToServer(String searchKey, AlphaCellModel cellModel) {
private void sendDataToServer(String searchKey, AlphaCellModel cellModel) {
if (cellModel.isNeedToSendToServer()) {
String username = DesignerEnvManager.getEnvManager().getBBSName();
String username = ConfigManager.getProviderInstance().getBbsUsername();
String uuid = DesignerEnvManager.getEnvManager().getUUID();
String activityKey = DesignerEnvManager.getEnvManager().getActivationKey();
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<>();
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());
HttpClient httpClient = new HttpClient(AlphaFineConstants.CLOUD_SERVER_URL, para, true);
httpClient.asGet();
if (!httpClient.isServerAlive()) {
FRLogger.getLogger().error("Failed to sent data to server!");
}
httpClient.setTimeout(5000);
}
@ -860,6 +875,33 @@ public class AlphaFineDialog extends UIDialog {
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
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();
super.setSelectedIndex(index);
AlphaCellModel cellModel = getSelectedValue();
@ -902,31 +946,16 @@ public class AlphaFineDialog extends UIDialog {
}
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() {
@Override
public void mouseClicked(MouseEvent e) {
int selectedIndex = getSelectedIndex();
AlphaCellModel selectedValue = getSelectedValue();
if (e.getClickCount() == 2 && selectedValue.hasAction()) {
doNavigate();
saveHistory(selectedValue);
dealWithSearchResult(selectedValue);
} else if (e.getClickCount() == 1) {
if (selectedValue instanceof MoreModel && ((MoreModel) selectedValue).isNeedMore()) {
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
public void addElement(AlphaCellModel element) {
AlphaFineHelper.checkCancel();
int index = myDelegate.size();
myDelegate.add(element);
fireContentsChanged(this, index, 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,8 +1075,13 @@ public class AlphaFineDialog extends UIDialog {
isValidSelected = selected;
}
@Override
public boolean isEmpty() {
return myDelegate.isEmpty();
}
public void resetState() {
for (int i = 0; i< getSize(); i++) {
for (int i = 0; i < getSize(); i++) {
getElementAt(i).resetState();
}
}

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

@ -1,16 +1,15 @@
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.AlphaFineListener;
import com.fr.design.constants.UIConstants;
import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.mainframe.alphafine.AlphaFineHelper;
import com.fr.design.utils.ThemeUtils;
import com.fr.general.IOUtils;
import com.fr.general.Inter;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
@ -21,17 +20,20 @@ import java.awt.event.ActionListener;
public class AlphaFinePane extends BasicPane {
private static AlphaFinePane alphaFinePane;
static {
Toolkit.getDefaultToolkit().addAWTEventListener(AlphaFineDialog.listener(), AWTEvent.KEY_EVENT_MASK);
}
public AlphaFinePane() {
setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 14));
if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isEnabled()) {
Toolkit.getDefaultToolkit().addAWTEventListener(AlphaFineDialog.listener(), AWTEvent.KEY_EVENT_MASK);
}
setPreferredSize(new Dimension(24, 24));
setLayout(new BorderLayout());
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.set4ToolbarButton();
refreshButton.setRolloverEnabled(false);
this.add(refreshButton);
this.setBackground(ThemeUtils.WHITE_BORDER_COLOR);
this.setBackground(UIConstants.TEMPLATE_TAB_PANE_BACKGROUND);
refreshButton.addActionListener(new ActionListener() {
@Override
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.mainframe.alphafine.AlphaFineConstants;
import com.fr.design.utils.gui.GUICoreUtils;
import javax.swing.*;
import java.awt.*;
@ -16,30 +15,18 @@ public class DocumentPreviewPane extends JPanel {
public DocumentPreviewPane(String title, String summary) {
this.setLayout(new BorderLayout());
this.setBackground(Color.WHITE);
this.setPreferredSize(new Dimension(AlphaFineConstants.RIGHT_WIDTH, AlphaFineConstants.CONTENT_HEIGHT));
UITextArea titleArea = new UITextArea(title);
UITextArea contentArea = new UITextArea(summary);
titleArea.setOpaque(false);
contentArea.setOpaque(false);
titleArea.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
titleArea.setBorder(null);
titleArea.setEditable(false);
titleArea.setForeground(AlphaFineConstants.BLUE);
contentArea.setForeground(AlphaFineConstants.BLACK);
titleArea.setPreferredSize(new Dimension(360, 30));
titleArea.setFont(AlphaFineConstants.LARGE_FONT);
contentArea.setFont(AlphaFineConstants.MEDIUM_FONT);
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);
}
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);
}
}

2
designer/src/com/fr/design/mainframe/alphafine/preview/FilePreviewPane.java

@ -18,7 +18,7 @@ public class FilePreviewPane extends JPanel {
float widthScale = (AlphaFineConstants.RIGHT_WIDTH) / (float) image.getWidth();
float heightScale = (AlphaFineConstants.CONTENT_HEIGHT) / (float) image.getHeight();
Image showImage;
showImage = widthScale > heightScale? image.getScaledInstance((int) (image.getWidth() * heightScale), AlphaFineConstants.CONTENT_HEIGHT, Image.SCALE_SMOOTH) : image.getScaledInstance(AlphaFineConstants.RIGHT_WIDTH, (int) (image.getWidth() * widthScale), Image.SCALE_SMOOTH);
showImage = widthScale > heightScale ? image.getScaledInstance((int) (image.getWidth() * heightScale), AlphaFineConstants.CONTENT_HEIGHT, Image.SCALE_SMOOTH) : image.getScaledInstance(AlphaFineConstants.RIGHT_WIDTH, (int) (image.getWidth() * widthScale), Image.SCALE_SMOOTH);
label.setIcon(new ImageIcon(showImage));
add(label);
}

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.setBorder(BorderFactory.createEmptyBorder(20, 20, 10, 20));
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);
priceLabel.setForeground(AlphaFineConstants.RED);
priceLabel.setFont(AlphaFineConstants.SMALL_FONT);
priceLabel.setFont(AlphaFineConstants.MEDIUM_FONT);
bottomPane.add(priceLabel, BorderLayout.WEST);
panel.add(nameLabel, BorderLayout.NORTH);
panel.add(line, BorderLayout.SOUTH);

13
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)) {
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")));
if (result.size() == 0) {
lessModelList.add(AlphaFineHelper.NO_RESULT_MODEL);
} else {
lessModelList.addAll(result);
}
lessModelList.addAll(result);
} else {
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));
@ -97,4 +94,4 @@ public class ActionSearchManager implements AlphaFineSearchProcessor {
public SearchResult getMoreSearchResult() {
return moreModelList;
}
}
}

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

@ -61,7 +61,6 @@ public class DocumentSearchManager implements AlphaFineSearchProcessor {
if (!httpClient.isServerAlive()) {
return getNoConnectList();
}
httpClient.setTimeout(5000);
result = httpClient.getResponseText();
AlphaFineHelper.checkCancel();
try {
@ -76,13 +75,11 @@ public class DocumentSearchManager implements AlphaFineSearchProcessor {
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")));
if (searchResult.size() == 0) {
lessModelList.add(AlphaFineHelper.NO_RESULT_MODEL);
} else {
lessModelList.addAll(searchResult);
}
lessModelList.addAll(searchResult);
} else {
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));
@ -91,7 +88,6 @@ public class DocumentSearchManager implements AlphaFineSearchProcessor {
}
} catch (JSONException e) {
FRLogger.getLogger().error("document search error: " + e.getMessage());
return lessModelList;
}
}
return lessModelList;
@ -114,4 +110,4 @@ public class DocumentSearchManager implements AlphaFineSearchProcessor {
return moreModelList;
}
}
}

20
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.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.List;
@ -83,6 +88,7 @@ public class FileSearchManager implements AlphaFineSearchProcessor {
Env env = FRContext.getCurrentEnv();
fileNodes = new ArrayList<>();
fileNodes = listTpl(env, ProjectConstants.REPORTLETS_NAME, true);
AlphaFineHelper.checkCancel();
isContainCpt = true;
isContainFrm = true;
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")));
if (result.size() == 0) {
lessModelList.add(AlphaFineHelper.NO_RESULT_MODEL);
} else {
lessModelList.addAll(result);
}
lessModelList.addAll(result);
} else {
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));
@ -248,4 +252,4 @@ public class FileSearchManager implements AlphaFineSearchProcessor {
public void setContainFrm(boolean containFrm) {
isContainFrm = containFrm;
}
}
}

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

@ -96,7 +96,6 @@ public class PluginSearchManager implements AlphaFineSearchProcessor {
if (!httpClient.isServerAlive()) {
return getNoConnectList();
}
httpClient.setTimeout(5000);
result = httpClient.getResponseText();
AlphaFineHelper.checkCancel();
JSONObject jsonObject = new JSONObject(result);
@ -104,18 +103,17 @@ public class PluginSearchManager implements AlphaFineSearchProcessor {
if (jsonArray != null) {
SearchResult searchResult = new SearchResult();
for (int i = 0; i < jsonArray.length(); i++) {
AlphaFineHelper.checkCancel();
PluginModel cellModel = getPluginModel(jsonArray.optJSONObject(i), false);
if (!AlphaFineHelper.getFilterResult().contains(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")));
if (searchResult.size() == 0) {
lessModelList.add(AlphaFineHelper.NO_RESULT_MODEL);
} else {
lessModelList.addAll(searchResult);
}
lessModelList.addAll(searchResult);
} else {
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));
@ -142,4 +140,4 @@ public class PluginSearchManager implements AlphaFineSearchProcessor {
public SearchResult getMoreSearchResult() {
return this.moreModelList;
}
}
}

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.MoreModel;
import com.fr.design.mainframe.alphafine.model.SearchResult;
import com.fr.design.mainframe.toolbar.UpdateActionManager;
import com.fr.file.XMLFileManager;
import com.fr.general.ComparatorUtils;
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.XMLableReader;
import java.io.*;
import java.util.*;
import java.io.File;
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.
@ -220,21 +230,24 @@ public class RecentSearchManager extends XMLFileManager implements AlphaFineSear
recentModelList = recentKVModelMap.get(searchText);
SearchResult resultModelList = recentModelList;
Iterator<AlphaCellModel> modelIterator = resultModelList.iterator();
SearchResult searchResult = new SearchResult();
while (modelIterator.hasNext()) {
AlphaCellModel model = modelIterator.next();
if (model.getType() == CellType.ACTION && !((ActionModel) model).getAction().isEnabled()) {
modelIterator.remove();
if (model.getType() == CellType.ACTION && !UpdateActionManager.getUpdateActionManager().isEnable(((ActionModel) model).getAction())) {
continue;
} else {
searchResult.add(model);
}
}
Collections.sort(resultModelList);
int size = resultModelList.size();
Collections.sort(searchResult);
int size = searchResult.size();
if (size > MAX_SIZE) {
SearchResult result = new SearchResult();
result.addAll(resultModelList.subList(0, MAX_SIZE));
result.addAll(searchResult.subList(0, MAX_SIZE));
return result;
}
return resultModelList;
return searchResult;
}
}
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.JSONObject;
import com.fr.stable.CodeUtils;
import com.fr.stable.StringUtils;
import java.util.Iterator;
import java.util.List;
@ -37,6 +38,7 @@ public class RecommendSearchManager implements AlphaFineSearchProcessor {
@Override
public synchronized SearchResult getLessSearchResult(String searchText) {
searchText = searchText.replaceAll(StringUtils.BLANK, StringUtils.EMPTY);
this.modelList = new SearchResult();
this.recommendModelList = new SearchResult();
if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isContainRecommend()) {

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

@ -1,59 +1,69 @@
/**
*
*
*/
package com.fr.design.mainframe.bbs;
import com.fr.general.IOUtils;
import com.fr.general.SiteCenter;
import com.fr.stable.StringUtils;
import java.util.Properties;
/**
* @author neil
*
* @date: 2015-3-10-上午9:50:13
*/
public class BBSConstants {
//判断是否更新的关键字
public static final String UPDATE_KEY = loadAttribute("UPDATE_KEY", "newIsPopup");
private static final String GUEST_KEY = "USER";
private static final String LINK_KEY = "LINK";
private static final int GUEST_NUM = 5;
//用户名信息数组
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 String[] loadAllGuestsInfo(String key){
String[] allGuests = new String[GUEST_NUM];
for (int i = 0; i < GUEST_NUM; i++) {
allGuests[i] = loadAttribute(key + i, StringUtils.EMPTY);
}
return allGuests;
}
//如果要定制, 直接改bbs.properties就行了
private static String loadAttribute(String key, String defaultValue) {
if (PROP == null) {
PROP = new Properties();
try {
PROP.load(IOUtils.getResourceAsStream("/com/fr/design/mainframe/bbs/bbs.properties", BBSConstants.class));
} catch (Exception e) {
}
}
String p = PROP.getProperty(key);
if (StringUtils.isEmpty(p)) {
p = defaultValue;
}
return p;
}
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_ONLINE = "guest.link";
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) {
return loadAttribute(key, 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;
}
//如果要定制, 直接改bbs.properties就行了
private static String loadAttribute(String key, String defaultValue) {
if (PROP == null) {
PROP = new Properties();
try {
PROP.load(IOUtils.getResourceAsStream("/com/fr/design/mainframe/bbs/bbs.properties", BBSConstants.class));
} catch (Exception e) {
}
}
String p = PROP.getProperty(key);
if (StringUtils.isEmpty(p)) {
p = defaultValue;
}
return p;
}
}

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

@ -3,15 +3,6 @@
*/
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.UILabel;
import com.fr.design.layout.FRGUIPaneFactory;
@ -21,6 +12,12 @@ import com.fr.general.Inter;
import com.fr.stable.StringUtils;
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
*
@ -54,9 +51,12 @@ public class BBSGuestPane extends JPanel implements BBSGuestPaneProvider{
double[] colSize = {p};
Component[][] components = new Component[rowSize.length][colSize.length];
for (int i = 0; i < components.length; i++) {
String userName = BBSConstants.ALL_GUEST[i];
String url = BBSConstants.ALL_LINK[i];
String[] allGuest = BBSConstants.getAllGuest();
String[] allLink = BBSConstants.getAllLink();
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);
}

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

@ -1,6 +1,8 @@
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.gui.ibutton.UIButton;
import com.fr.design.gui.ilable.ActionLabel;
@ -207,8 +209,8 @@ public class BBSLoginDialog extends UIDialog {
// 登录成功
private void loginSuccess() {
DesignerEnvManager.getEnvManager().setBBSPassword(String.valueOf(passField.getPassword()));
userInfoLabel.setUserName(nameField.getText());
String password = String.valueOf(passField.getPassword());
BBSLoginUtils.bbsLogin(nameField.getText(), password);
userInfoLabel.getUserInfoPane().markSignIn(nameField.getText());
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.design.DesignerEnvManager;
import com.fr.design.bbs.BBSLoginUtils;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.imenu.UIMenuItem;
import com.fr.design.gui.imenu.UIPopupMenu;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.Inter;
import com.fr.stable.StringUtils;
/**
* @author neil
@ -61,8 +60,7 @@ public class ExitLabel extends UILabel{
}
private void clearLoingInformation(){
DesignerEnvManager.getEnvManager().setBBSName(StringUtils.EMPTY);
DesignerEnvManager.getEnvManager().setBBSPassword(StringUtils.EMPTY);
BBSLoginUtils.bbsLogout();
}
private void updateInfoPane(){

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

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

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

@ -3,25 +3,27 @@
*/
package com.fr.design.mainframe.bbs;
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;
import com.fr.base.ConfigManager;
import com.fr.base.FRContext;
import com.fr.design.DesignerEnvManager;
import com.fr.design.constants.UIConstants;
import com.fr.design.dialog.BasicPane;
import com.fr.design.mainframe.DesignerContext;
import com.fr.general.DateUtils;
import com.fr.general.FRLogger;
import com.fr.general.GeneralContext;
import com.fr.general.Inter;
import com.fr.plugin.manage.bbs.BBSPluginLogin;
import com.fr.plugin.manage.bbs.BBSUserInfo;
import com.fr.stable.EnvChangedListener;
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
@ -31,7 +33,7 @@ import com.fr.stable.StringUtils;
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 int WIDTH = 104;
private static final int HEIGHT = 24;
@ -46,6 +48,7 @@ public class UserInfoPane extends BasicPane{
private UserInfoLabel userInfoLabel;
public UserInfoLabel getUserInfoLabel() {
return userInfoLabel;
}
@ -65,29 +68,26 @@ public class UserInfoPane extends BasicPane{
this.userInfoLabel = new UserInfoLabel(this);
this.markUnSignIn();
autoLogin();
addEnvChangedListener();
autoPushLoginDialog();
this.add(userInfoLabel, BorderLayout.CENTER);
}
// 后台自动登录
private void autoLogin(){
Thread bbsAutoLoginThread = new Thread(new Runnable() {
private void addEnvChangedListener(){
GeneralContext.addEnvChangedListener(new EnvChangedListener() {
@Override
public void run() {
String username = DesignerEnvManager.getEnvManager().getBBSName();
String inShowUsername = DesignerEnvManager.getEnvManager().getInShowBBsName();
if (StringUtils.isEmpty(username) && StringUtils.isEmpty(inShowUsername)){
public void envChanged() {
String username = ConfigManager.getProviderInstance().getBbsUsername();
if (StringUtils.isEmpty(username)){
markUnSignIn();
} else {
markSignIn(username);
}
}
});
bbsAutoLoginThread.start();
}
// 计算xml保存的上次弹框时间和当前时间的时间差
private int getDiffFromLastLogin(){
@ -133,7 +133,7 @@ public class UserInfoPane extends BasicPane{
FRContext.getLogger().error(e.getMessage());
}
String userName = DesignerEnvManager.getEnvManager().getBBSName();
String userName = ConfigManager.getProviderInstance().getBbsUsername();
if(StringUtils.isNotEmpty(userName)){
return;
}
@ -169,8 +169,6 @@ public class UserInfoPane extends BasicPane{
*
*/
public void markSignIn(String userName){
String password = DesignerEnvManager.getEnvManager().getBBSPassword();
BBSPluginLogin.getInstance().login(new BBSUserInfo(userName, password));
this.userInfoLabel.setText(userName);
this.userInfoLabel.setUserName(userName);
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
GET_MESSAGE_URL=http://feedback.finedevelop.com:3000/bbs/message/count
GET_SIGN_INFO_URL=http\://bbs.finereport.com
LINK0=http\://bbs.finereport.com/space-uid-55823.html
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
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
SHARE_URL=http\://bbs.finereport.com
USER0=\u6590\u6CE2\u90A3\u5951(\u5B59\u70B3\u6DA6)
USER1=deafire(\u674E\u5FD7\u4F1F)
USER2=\u963F\u8FEA(\u8C22\u8FEA)
USER3=bingjie(\u5F20\u8BB0\u82B1)
USER4=\u6D77\u7EF5\u5B9D\u5B9D(\u90DD\u6B63)
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
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

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
*/
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 TemplateCellElement cellelement;
private ElementCasePane ePane;
private UIHeadGroup tabsHeaderIconPane;
private boolean isEditing;
private int PaneListIndex;
private CardLayout card;
private JPanel center;
private JPanel downTitle;
private JPanel title;
private UILabel titlename;
private TitleChangeListener titleChangeListener = 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() {
setLayout(new BorderLayout());
initPaneList();
@ -89,7 +76,7 @@ public class CellElementEditPane extends BasicPane {
downTitle = new JPanel();
downTitle.setLayout(new BorderLayout());
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);
this.add(downTitle, BorderLayout.CENTER);

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

Loading…
Cancel
Save