Browse Source

Merging in latest from upstream (BA/design:refs/heads/release/9.0)

* commit '940a892bb9ad571a6ceaae40c1d13ab2df62b3ca': (31 commits)
  无JIRA任务,代码规范
  REPORT-2897 9.0设计器修改 交互->聚合报表刻度等比缩放(精度四舍五入)
  无JIRA任务,代码规范
  REPORT-4423 缩放条问题 修改滚轮一格缩放比例
  无JIRA任务,代码规范
  REPORT-4412 插件脚本文件更新问题 2/3
  REPORT-4334 设置按钮图标问题
  REPORT-4099 [9.0一轮回归]权限编辑无法选中单元格
  rt
  搜索去除中文输入法的影响 多线程问题
  REPORT-4395 设计器信息收集地址从网址中心获取
  REPORT-4332 & REPORT-3740 9.0设计器表单花屏问题;[9.0一轮回归]表单显示异常
  REPORT-3837 代码规范
  REPORT-3837 代码规范
  rt
  rt
  插件搜索问题
  REPORT-3837 [9.0一轮回归]新建单元 格条件属性自动显示之前公式状态=>修复强转给其他地方引入的bug
  rt
  键盘监听修改
  ...
master
kerry 7 years ago
parent
commit
f3f73f3c4d
  1. 2
      designer/src/com/fr/design/dscolumn/DSColumnConditionsPane.java
  2. 2
      designer/src/com/fr/design/mainframe/ElementCasePaneDelegate.java
  3. 2
      designer/src/com/fr/design/mainframe/JWorkBook.java
  4. 3
      designer/src/com/fr/design/mainframe/ReportComponentComposite.java
  5. 134
      designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java
  6. 4
      designer/src/com/fr/design/mainframe/alphafine/preview/PluginPreviewPane.java
  7. 5
      designer/src/com/fr/design/mainframe/alphafine/search/manager/ActionSearchManager.java
  8. 7
      designer/src/com/fr/design/mainframe/alphafine/search/manager/DocumentSearchManager.java
  9. 5
      designer/src/com/fr/design/mainframe/alphafine/search/manager/FileSearchManager.java
  10. 8
      designer/src/com/fr/design/mainframe/alphafine/search/manager/PluginSearchManager.java
  11. 3
      designer/src/com/fr/design/mainframe/form/FormReportComponentComposite.java
  12. 10
      designer/src/com/fr/start/CollectUserInformationDialog.java
  13. 5
      designer_base/src/com/fr/design/actions/help/alphafine/AlphaFineConfigManager.java
  14. 34
      designer_base/src/com/fr/design/condition/LiteConditionPane.java
  15. 8
      designer_base/src/com/fr/design/condition/ObjectLiteConditionPane.java
  16. 34
      designer_base/src/com/fr/design/extra/PluginStoreConstants.java
  17. 7
      designer_base/src/com/fr/design/extra/WebViewDlgHelper.java
  18. 9
      designer_base/src/com/fr/design/gui/icontainer/UIScrollPane.java
  19. 2
      designer_base/src/com/fr/design/locale/designer_en_US.properties
  20. 2
      designer_base/src/com/fr/design/locale/designer_ja_JP.properties
  21. 2
      designer_base/src/com/fr/design/locale/designer_ko_KR.properties
  22. 2
      designer_base/src/com/fr/design/locale/designer_zh_CN.properties
  23. 2
      designer_base/src/com/fr/design/locale/designer_zh_TW.properties
  24. 6
      designer_base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java
  25. 4
      designer_base/src/com/fr/design/scrollruler/HorizontalRulerUI.java
  26. 4
      designer_base/src/com/fr/design/scrollruler/VerticalRulerUI.java
  27. 191
      designer_base/src/com/fr/design/web/CustomIconPane.java
  28. 33
      designer_form/src/com/fr/design/mainframe/FormArea.java
  29. 46
      designer_form/src/com/fr/design/mainframe/JForm.java

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

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

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

@ -47,7 +47,7 @@ public class ElementCasePaneDelegate extends ElementCasePane<WorkSheet> {
this.addSelectionChangeListener(new SelectionListener() { this.addSelectionChangeListener(new SelectionListener() {
@Override @Override
public void selectionChanged(SelectionEvent e) { public void selectionChanged(SelectionEvent e) {
if (!isEditable()) { if (!isEditable() && !BaseUtils.isAuthorityEditing()) {
return; return;
} }
doOnSelectionChanged(e); doOnSelectionChanged(e);

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

@ -92,7 +92,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
private UIModeControlContainer centerPane; private UIModeControlContainer centerPane;
public ReportComponentComposite reportComposite; public ReportComponentComposite reportComposite;
private ParameterDefinitePane parameterPane; private ParameterDefinitePane parameterPane;
private int resolution; private int resolution = ScreenResolution.getScreenResolution();
public JWorkBook() { public JWorkBook() {
super(new WorkBook(new WorkSheet()), "WorkBook"); super(new WorkBook(new WorkSheet()), "WorkBook");

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

@ -33,6 +33,7 @@ public class ReportComponentComposite extends JComponent {
private static final int MAX = 400; private static final int MAX = 400;
private static final int HUND = 100; private static final int HUND = 100;
private static final int MIN = 10; private static final int MIN = 10;
private static final int DIR = 15;
private JWorkBook parent; private JWorkBook parent;
private UIModeControlContainer parentContainer = null; private UIModeControlContainer parentContainer = null;
@ -71,7 +72,7 @@ public class ReportComponentComposite extends JComponent {
if (InputEventBaseOnOS.isControlDown(e)) { if (InputEventBaseOnOS.isControlDown(e)) {
int dir = e.getWheelRotation(); int dir = e.getWheelRotation();
int old_resolution = (int) jSliderContainer.getShowVal().getValue(); int old_resolution = (int) jSliderContainer.getShowVal().getValue();
jSliderContainer.getShowVal().setValue(old_resolution - (dir * MIN)); jSliderContainer.getShowVal().setValue(old_resolution - (dir * DIR));
} }
} }
}; };

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

@ -71,6 +71,7 @@ public class AlphaFineDialog extends UIDialog {
private static final String PLUGIN_MARK_SHORT = "k:4 "; private static final String PLUGIN_MARK_SHORT = "k:4 ";
private static final String PLUGIN_MARK = "k:shop "; private static final String PLUGIN_MARK = "k:shop ";
private static final String PLACE_HOLDER = Inter.getLocText("FR-Designer_AlphaFine"); private static final String PLACE_HOLDER = Inter.getLocText("FR-Designer_AlphaFine");
private static final int MAX_SHOW_SIZE = 12;
private AlphaFineTextField searchTextField; private AlphaFineTextField searchTextField;
private UIButton closeButton; private UIButton closeButton;
@ -89,7 +90,6 @@ public class AlphaFineDialog extends UIDialog {
//是否强制打开,因为面板是否关闭绑定了全局鼠标事件,这里需要处理一下 //是否强制打开,因为面板是否关闭绑定了全局鼠标事件,这里需要处理一下
private boolean forceOpen; private boolean forceOpen;
public AlphaFineDialog(Frame parent, boolean forceOpen) { public AlphaFineDialog(Frame parent, boolean forceOpen) {
super(parent); super(parent);
this.forceOpen = forceOpen; this.forceOpen = forceOpen;
@ -161,12 +161,6 @@ public class AlphaFineDialog extends UIDialog {
}); });
topPane.add(closeButton, BorderLayout.EAST); topPane.add(closeButton, BorderLayout.EAST);
add(topPane, BorderLayout.CENTER); add(topPane, BorderLayout.CENTER);
searchTextField.getDocument().addDocumentListener(new DocumentAdapter() {
@Override
protected void textChanged(DocumentEvent e) {
doSearch(searchTextField.getText());
}
});
} }
/** /**
@ -174,7 +168,7 @@ public class AlphaFineDialog extends UIDialog {
*/ */
private void initSearchTextField() { private void initSearchTextField() {
searchTextField = new AlphaFineTextField(PLACE_HOLDER); searchTextField = new AlphaFineTextField(PLACE_HOLDER);
initTextFieldKeyListener(); initTextFieldListener();
searchTextField.setFont(AlphaFineConstants.GREATER_FONT); searchTextField.setFont(AlphaFineConstants.GREATER_FONT);
searchTextField.setBackground(Color.WHITE); searchTextField.setBackground(Color.WHITE);
searchTextField.setBorderPainted(false); searchTextField.setBorderPainted(false);
@ -228,16 +222,11 @@ public class AlphaFineDialog extends UIDialog {
* @param text * @param text
*/ */
private void doSearch(String text) { private void doSearch(String text) {
showSearchResult(text);
if (StringUtils.isBlank(text) || isNeedSearch(text)) {
removeSearchResult();
} else {
showSearchResult();
}
} }
boolean isNeedSearch(String text) { boolean isNoNeedSearch(String text) {
return ComparatorUtils.equals(PLACE_HOLDER, text) || text.contains("'"); return ComparatorUtils.equals(PLACE_HOLDER, text) || text.contains("'") || StringUtils.isBlank(text);
} }
@Override @Override
@ -272,17 +261,17 @@ public class AlphaFineDialog extends UIDialog {
searchResultPane = null; searchResultPane = null;
} }
setSize(AlphaFineConstants.FIELD_SIZE); setSize(AlphaFineConstants.FIELD_SIZE);
repaint(); refreshContainer();
} }
/** /**
* 展示搜索结果 * 展示搜索结果
*/ */
private void showSearchResult() { private void showSearchResult(String text) {
if (searchResultPane == null) { if (searchResultPane == null) {
initSearchResultComponents(); initSearchResultComponents();
} }
initSearchWorker(); initSearchWorker(text);
} }
/** /**
@ -299,8 +288,8 @@ public class AlphaFineDialog extends UIDialog {
searchResultList.setCellRenderer(new ContentCellRender()); searchResultList.setCellRenderer(new ContentCellRender());
leftSearchResultPane = new UIScrollPane(searchResultList); leftSearchResultPane = new UIScrollPane(searchResultList);
leftSearchResultPane.setBorder(null);
leftSearchResultPane.setBackground(Color.WHITE); leftSearchResultPane.setBackground(Color.WHITE);
leftSearchResultPane.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
leftSearchResultPane.setPreferredSize(new Dimension(AlphaFineConstants.LEFT_WIDTH, AlphaFineConstants.CONTENT_HEIGHT)); leftSearchResultPane.setPreferredSize(new Dimension(AlphaFineConstants.LEFT_WIDTH, AlphaFineConstants.CONTENT_HEIGHT));
rightSearchResultPane = new JPanel(); rightSearchResultPane = new JPanel();
rightSearchResultPane.setBackground(Color.WHITE); rightSearchResultPane.setBackground(Color.WHITE);
@ -317,7 +306,7 @@ public class AlphaFineDialog extends UIDialog {
/** /**
* 异步加载搜索结果 * 异步加载搜索结果
*/ */
private void initSearchWorker() { private void initSearchWorker(final String text) {
if (this.searchWorker != null && !this.searchWorker.isDone()) { if (this.searchWorker != null && !this.searchWorker.isDone()) {
this.searchWorker.cancel(true); this.searchWorker.cancel(true);
this.searchWorker = null; this.searchWorker = null;
@ -325,9 +314,7 @@ public class AlphaFineDialog extends UIDialog {
this.searchWorker = new SwingWorker() { this.searchWorker = new SwingWorker() {
@Override @Override
protected Object doInBackground() throws Exception { protected Object doInBackground() throws Exception {
resumeLeftPane(); rebuildList(text);
splitLabel.setIcon(new ImageIcon(getClass().getResource("/com/fr/design/mainframe/alphafine/images/bigloading.gif")));
rebuildList(searchTextField.getText().toLowerCase());
return null; return null;
} }
@ -347,11 +334,9 @@ public class AlphaFineDialog extends UIDialog {
*/ */
private void resumeLeftPane() { private void resumeLeftPane() {
if (searchResultPane != null && defaultPane != null) { if (searchResultPane != null && defaultPane != null) {
rightSearchResultPane.removeAll();
searchResultPane.remove(defaultPane); searchResultPane.remove(defaultPane);
defaultPane = null; defaultPane = null;
searchResultPane.add(leftSearchResultPane, BorderLayout.WEST); searchResultPane.add(leftSearchResultPane, BorderLayout.WEST);
refreshContainer();
} }
} }
@ -394,25 +379,26 @@ public class AlphaFineDialog extends UIDialog {
*/ */
private void rebuildList(String searchText) { private void rebuildList(String searchText) {
resetContainer(); resetContainer();
if (searchText.startsWith(ADVANCED_SEARCH_MARK)) { if (searchText.startsWith(ADVANCED_SEARCH_MARK)) {
if (searchText.startsWith(ACTION_MARK_SHORT) || searchText.startsWith(ACTION_MARK)) { if (searchText.startsWith(ACTION_MARK_SHORT) || searchText.startsWith(ACTION_MARK)) {
storeText = searchText.substring(searchText.indexOf(StringUtils.BLANK) + 1, searchText.length()); storeText = searchText.substring(searchText.indexOf(StringUtils.BLANK) + 1, searchText.length());
getActionList(storeText); buildActionList(storeText);
} else if (searchText.startsWith(DOCUMENT_MARK_SHORT) || searchText.startsWith(DOCUMENT_MARK)) { } else if (searchText.startsWith(DOCUMENT_MARK_SHORT) || searchText.startsWith(DOCUMENT_MARK)) {
storeText = searchText.substring(searchText.indexOf(StringUtils.BLANK) + 1, searchText.length()); storeText = searchText.substring(searchText.indexOf(StringUtils.BLANK) + 1, searchText.length());
getDocumentList(storeText); buildDocumentList(storeText);
} else if (searchText.startsWith(FILE_MARK_SHORT) || searchText.startsWith(FILE_MARK)) { } else if (searchText.startsWith(FILE_MARK_SHORT) || searchText.startsWith(FILE_MARK)) {
storeText = searchText.substring(searchText.indexOf(StringUtils.BLANK) + 1, searchText.length()); storeText = searchText.substring(searchText.indexOf(StringUtils.BLANK) + 1, searchText.length());
getFileList(storeText); buildFileList(storeText);
} else if (searchText.startsWith(CPT_MARK) || searchText.startsWith(FRM_MARK)) { } else if (searchText.startsWith(CPT_MARK) || searchText.startsWith(FRM_MARK)) {
storeText = searchText.substring(searchText.indexOf(StringUtils.BLANK) + 1, searchText.length()); storeText = searchText.substring(searchText.indexOf(StringUtils.BLANK) + 1, searchText.length());
getFileList(searchText); buildFileList(searchText);
} else if (searchText.startsWith(DS_MARK)) { } else if (searchText.startsWith(DS_MARK)) {
storeText = searchText.substring(searchText.indexOf(StringUtils.BLANK) + 1, searchText.length()); storeText = searchText.substring(searchText.indexOf(StringUtils.BLANK) + 1, searchText.length());
getFileList(DS_NAME + storeText); buildFileList(DS_NAME + storeText);
} else if (searchText.startsWith(PLUGIN_MARK_SHORT) || searchText.startsWith(PLUGIN_MARK)) { } else if (searchText.startsWith(PLUGIN_MARK_SHORT) || searchText.startsWith(PLUGIN_MARK)) {
storeText = searchText.substring(searchText.indexOf(StringUtils.BLANK) + 1, searchText.length()); storeText = searchText.substring(searchText.indexOf(StringUtils.BLANK) + 1, searchText.length());
getPluginList(storeText); buildPluginList(storeText);
} }
} else { } else {
storeText = searchText.trim(); storeText = searchText.trim();
@ -425,9 +411,11 @@ public class AlphaFineDialog extends UIDialog {
* 重置面板 * 重置面板
*/ */
private void resetContainer() { private void resetContainer() {
rightSearchResultPane.removeAll();
splitLabel.setIcon(new ImageIcon(getClass().getResource("/com/fr/design/mainframe/alphafine/images/bigloading.gif")));
resumeLeftPane();
searchListModel.removeAllElements(); searchListModel.removeAllElements();
searchListModel.resetSelectedState(); searchListModel.resetSelectedState();
rightSearchResultPane.removeAll();
refreshContainer(); refreshContainer();
} }
@ -437,23 +425,22 @@ public class AlphaFineDialog extends UIDialog {
* @param searchText * @param searchText
*/ */
private void doNormalSearch(String searchText) { private void doNormalSearch(String searchText) {
getRecentList(searchText); buildRecentList(searchText);
getRecommendList(searchText); buildRecommendList(searchText);
getActionList(searchText); buildActionList(searchText);
getFileList(searchText); buildFileList(searchText);
getDocumentList(searchText); buildDocumentList(searchText);
getPluginList(searchText); buildPluginList(searchText);
} }
private void getDocumentList(final String searchText) { private void buildDocumentList(final String searchText) {
SearchResult documentModelList = DocumentSearchManager.getDocumentSearchManager().getLessSearchResult(searchText); SearchResult documentModelList = DocumentSearchManager.getDocumentSearchManager().getLessSearchResult(searchText);
for (AlphaCellModel object : documentModelList) { for (AlphaCellModel object : documentModelList) {
AlphaFineHelper.checkCancel();
searchListModel.addElement(object); searchListModel.addElement(object);
} }
} }
private void getFileList(final String searchText) { private void buildFileList(final String searchText) {
SearchResult fileModelList = FileSearchManager.getFileSearchManager().getLessSearchResult(searchText); SearchResult fileModelList = FileSearchManager.getFileSearchManager().getLessSearchResult(searchText);
for (AlphaCellModel object : fileModelList) { for (AlphaCellModel object : fileModelList) {
AlphaFineHelper.checkCancel(); AlphaFineHelper.checkCancel();
@ -461,34 +448,30 @@ public class AlphaFineDialog extends UIDialog {
} }
} }
private void getActionList(final String searchText) { private void buildActionList(final String searchText) {
SearchResult actionModelList = ActionSearchManager.getActionSearchManager().getLessSearchResult(searchText); SearchResult actionModelList = ActionSearchManager.getActionSearchManager().getLessSearchResult(searchText);
for (AlphaCellModel object : actionModelList) { for (AlphaCellModel object : actionModelList) {
AlphaFineHelper.checkCancel();
searchListModel.addElement(object); searchListModel.addElement(object);
} }
} }
private void getPluginList(final String searchText) { private void buildPluginList(final String searchText) {
SearchResult pluginModelList = PluginSearchManager.getPluginSearchManager().getLessSearchResult(searchText); SearchResult pluginModelList = PluginSearchManager.getPluginSearchManager().getLessSearchResult(searchText);
for (AlphaCellModel object : pluginModelList) { for (AlphaCellModel object : pluginModelList) {
AlphaFineHelper.checkCancel();
searchListModel.addElement(object); searchListModel.addElement(object);
} }
} }
private void getRecommendList(final String searchText) { private void buildRecommendList(final String searchText) {
SearchResult recommendModelList = RecommendSearchManager.getRecommendSearchManager().getLessSearchResult(searchText); SearchResult recommendModelList = RecommendSearchManager.getRecommendSearchManager().getLessSearchResult(searchText);
for (AlphaCellModel object : recommendModelList) { for (AlphaCellModel object : recommendModelList) {
AlphaFineHelper.checkCancel();
searchListModel.addElement(object); searchListModel.addElement(object);
} }
} }
private void getRecentList(final String searchText) { private void buildRecentList(final String searchText) {
SearchResult recentModelList = RecentSearchManager.getRecentSearchManger().getLessSearchResult(searchText); SearchResult recentModelList = RecentSearchManager.getRecentSearchManger().getLessSearchResult(searchText);
for (AlphaCellModel object : recentModelList) { for (AlphaCellModel object : recentModelList) {
AlphaFineHelper.checkCancel();
searchListModel.addElement(object); searchListModel.addElement(object);
} }
@ -639,11 +622,10 @@ public class AlphaFineDialog extends UIDialog {
} }
} }
private void HandleMoreOrLessResult(int index, MoreModel selectedValue) { private void dealWithMoreOrLessResult(int index, MoreModel selectedValue) {
if (selectedValue.getContent().equals(Inter.getLocText("FR-Designer_AlphaFine_ShowAll"))) { if (ComparatorUtils.equals(Inter.getLocText("FR-Designer_AlphaFine_ShowAll"), selectedValue.getContent())) {
selectedValue.setContent(Inter.getLocText("FR-Designer_AlphaFine_ShowLess")); selectedValue.setContent(Inter.getLocText("FR-Designer_AlphaFine_ShowLess"));
rebuildShowMoreList(index, selectedValue); rebuildShowMoreList(index, selectedValue);
} else { } else {
selectedValue.setContent(Inter.getLocText("FR-Designer_AlphaFine_ShowAll")); selectedValue.setContent(Inter.getLocText("FR-Designer_AlphaFine_ShowAll"));
rebuildShowMoreList(index, selectedValue); rebuildShowMoreList(index, selectedValue);
@ -655,8 +637,7 @@ public class AlphaFineDialog extends UIDialog {
UILabel label = new UILabel(new ImageIcon(getClass().getResource("/com/fr/design/mainframe/alphafine/images/opening.gif"))); UILabel label = new UILabel(new ImageIcon(getClass().getResource("/com/fr/design/mainframe/alphafine/images/opening.gif")));
label.setBorder(BorderFactory.createEmptyBorder(120, 0, 0, 0)); label.setBorder(BorderFactory.createEmptyBorder(120, 0, 0, 0));
rightSearchResultPane.add(label, BorderLayout.CENTER); rightSearchResultPane.add(label, BorderLayout.CENTER);
validate(); refreshContainer();
repaint();
} }
/** /**
@ -667,18 +648,15 @@ public class AlphaFineDialog extends UIDialog {
} }
/** /**
* 为textfield添加键盘监听器 * 为textfield添加监听器
*/ */
private void initTextFieldKeyListener() { private void initTextFieldListener() {
searchTextField.addKeyListener(new KeyAdapter() { searchTextField.addKeyListener(new KeyAdapter() {
@Override @Override
public void keyPressed(KeyEvent e) { public void keyPressed(KeyEvent e) {
if (e.getKeyCode() == KeyEvent.VK_DOWN) { if (e.getKeyCode() == KeyEvent.VK_DOWN) {
searchResultList.requestFocus(); searchResultList.requestFocus();
searchResultList.setSelectedIndex(searchResultList.getSelectedIndex() + 1); searchResultList.setSelectedIndex(searchResultList.getSelectedIndex() + 1);
} else if (e.getKeyCode() == KeyEvent.VK_ENTER) {
doNavigate();
saveHistory(searchResultList.getSelectedValue());
} }
} }
@ -690,7 +668,25 @@ public class AlphaFineDialog extends UIDialog {
AlphaFineDialog.this.setVisible(false); AlphaFineDialog.this.setVisible(false);
} else { } else {
searchTextField.setText(null); searchTextField.setText(null);
removeSearchResult();
}
}
}
});
searchTextField.getDocument().addDocumentListener(new DocumentAdapter() {
@Override
protected void textChanged(DocumentEvent e) {
if (isNoNeedSearch(searchTextField.getText())) {
removeSearchResult();
} else {
try {
Thread.sleep(10);
doSearch(searchTextField.getText());
} catch (InterruptedException e1) {
FRLogger.getLogger().error(e1.getMessage());
} }
} }
} }
}); });
@ -726,7 +722,7 @@ public class AlphaFineDialog extends UIDialog {
@Override @Override
public void checkValid() throws Exception { public void checkValid() throws Exception {
//不处理
} }
private void doNavigate() { private void doNavigate() {
@ -778,7 +774,6 @@ public class AlphaFineDialog extends UIDialog {
if (!httpClient.isServerAlive()) { if (!httpClient.isServerAlive()) {
FRLogger.getLogger().error("Failed to sent data to server!"); FRLogger.getLogger().error("Failed to sent data to server!");
} }
httpClient.setTimeout(5000);
} }
@ -935,7 +930,7 @@ public class AlphaFineDialog extends UIDialog {
saveHistory(selectedValue); saveHistory(selectedValue);
} else if (e.getClickCount() == 1) { } else if (e.getClickCount() == 1) {
if (selectedValue instanceof MoreModel && ((MoreModel) selectedValue).isNeedMore()) { if (selectedValue instanceof MoreModel && ((MoreModel) selectedValue).isNeedMore()) {
HandleMoreOrLessResult(selectedIndex, (MoreModel) selectedValue); dealWithMoreOrLessResult(selectedIndex, (MoreModel) selectedValue);
} }
} }
} }
@ -971,10 +966,23 @@ public class AlphaFineDialog extends UIDialog {
@Override @Override
public void addElement(AlphaCellModel element) { public void addElement(AlphaCellModel element) {
AlphaFineHelper.checkCancel();
int index = myDelegate.size(); int index = myDelegate.size();
myDelegate.add(element); myDelegate.add(element);
fireContentsChanged(this, index, index); fireContentsChanged(this, index, index);
fireSelectedStateChanged(element, index); fireSelectedStateChanged(element, index);
}
@Override
protected void fireContentsChanged(Object source, int index0, int index1) {
if (myDelegate.size() > MAX_SHOW_SIZE) {
leftSearchResultPane.getVerticalScrollBar().setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 0));
leftSearchResultPane.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 2));
} else {
leftSearchResultPane.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
}
super.fireContentsChanged(source, index0, index1);
} }
/** /**

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

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

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

@ -75,10 +75,9 @@ public class ActionSearchManager implements AlphaFineSearchProcessor {
result.add(object); result.add(object);
} }
} }
if (result.size() == 0) { if (result.isEmpty()) {
return lessModelList; return lessModelList;
} } else if (result.size() < AlphaFineConstants.SHOW_SIZE + 1) {
if (result.size() > 0 && result.size() < AlphaFineConstants.SHOW_SIZE + 1) {
lessModelList.add(0, new MoreModel(Inter.getLocText("FR-Designer_Set"))); lessModelList.add(0, new MoreModel(Inter.getLocText("FR-Designer_Set")));
lessModelList.addAll(result); lessModelList.addAll(result);
} else { } else {

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

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

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

@ -100,10 +100,9 @@ public class FileSearchManager implements AlphaFineSearchProcessor {
} }
} }
if (result.size() == 0) { if (result.isEmpty()) {
return lessModelList; return lessModelList;
} } else if (result.size() < AlphaFineConstants.SHOW_SIZE + 1) {
if (result.size() > 0 && result.size() < AlphaFineConstants.SHOW_SIZE + 1) {
lessModelList.add(0, new MoreModel(Inter.getLocText("FR-Designer_Templates"))); lessModelList.add(0, new MoreModel(Inter.getLocText("FR-Designer_Templates")));
lessModelList.addAll(result); lessModelList.addAll(result);
} else { } else {

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

@ -96,7 +96,6 @@ public class PluginSearchManager implements AlphaFineSearchProcessor {
if (!httpClient.isServerAlive()) { if (!httpClient.isServerAlive()) {
return getNoConnectList(); return getNoConnectList();
} }
httpClient.setTimeout(5000);
result = httpClient.getResponseText(); result = httpClient.getResponseText();
AlphaFineHelper.checkCancel(); AlphaFineHelper.checkCancel();
JSONObject jsonObject = new JSONObject(result); JSONObject jsonObject = new JSONObject(result);
@ -109,11 +108,10 @@ public class PluginSearchManager implements AlphaFineSearchProcessor {
searchResult.add(cellModel); searchResult.add(cellModel);
} }
} }
if (searchResult.size() == 0) { if (searchResult.isEmpty()) {
return this.lessModelList; return this.lessModelList;
} } else if (searchResult.size() < AlphaFineConstants.SHOW_SIZE + 1) {
if (searchResult.size() > 0 && searchResult.size() < AlphaFineConstants.SHOW_SIZE + 1) { lessModelList.add(0, new MoreModel(Inter.getLocText("FR-Designer-Plugin_Addon")));
lessModelList.add(0, new MoreModel(Inter.getLocText("FR-Designer_Templates")));
lessModelList.addAll(searchResult); lessModelList.addAll(searchResult);
} else { } else {
lessModelList.add(0, new MoreModel(Inter.getLocText("FR-Designer-Plugin_Addon"), Inter.getLocText("FR-Designer_AlphaFine_ShowAll"), true, CellType.PLUGIN)); lessModelList.add(0, new MoreModel(Inter.getLocText("FR-Designer-Plugin_Addon"), Inter.getLocText("FR-Designer_AlphaFine_ShowAll"), true, CellType.PLUGIN));

3
designer/src/com/fr/design/mainframe/form/FormReportComponentComposite.java

@ -34,6 +34,7 @@ public class FormReportComponentComposite extends JComponent implements TargetMo
private static final int MAX = 400; private static final int MAX = 400;
private static final int HUND = 100; private static final int HUND = 100;
private static final int MIN = 10; private static final int MIN = 10;
private static final int DIR = 15;
private static final double MIN_TIME = 0.4; private static final double MIN_TIME = 0.4;
public FormElementCaseDesigner elementCaseDesigner; public FormElementCaseDesigner elementCaseDesigner;
private BaseJForm jForm; private BaseJForm jForm;
@ -61,7 +62,7 @@ public class FormReportComponentComposite extends JComponent implements TargetMo
if (InputEventBaseOnOS.isControlDown(e)) { if (InputEventBaseOnOS.isControlDown(e)) {
int dir = e.getWheelRotation(); int dir = e.getWheelRotation();
int old_resolution = (int) jSliderContainer.getShowVal().getValue(); int old_resolution = (int) jSliderContainer.getShowVal().getValue();
jSliderContainer.getShowVal().setValue(old_resolution - (dir * MIN)); jSliderContainer.getShowVal().setValue(old_resolution - (dir * DIR));
} }
} }
}; };

10
designer/src/com/fr/start/CollectUserInformationDialog.java

@ -14,6 +14,7 @@ import com.fr.design.mainframe.ActiveKeyGenerator;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.general.SiteCenter;
import com.fr.stable.OperatingSystem; import com.fr.stable.OperatingSystem;
import javax.swing.*; import javax.swing.*;
@ -28,12 +29,13 @@ import java.util.Locale;
public class CollectUserInformationDialog extends UIDialog { public class CollectUserInformationDialog extends UIDialog {
private static final String CN_LOGIN_HTML = "http://www.finereport.com/products/frlogin";
private static final String EN_LOGIN_HTML = "http://www.finereport.com/en/frlogin";
private static final String TW_LOGIN_HTML = "http://www.finereport.com/tw/products/frlogin";
private static final String JP_LOGIN_HTML = "http://www.finereport.com/jp/products/frlogin";
private static final int ONLINE_VERIFY_TIMEOUT = 30 * 1000; private static final int ONLINE_VERIFY_TIMEOUT = 30 * 1000;
private static final String CN_LOGIN_HTML = SiteCenter.getInstance().acquireUrlByKind("frlogin.cn");
private static final String EN_LOGIN_HTML = SiteCenter.getInstance().acquireUrlByKind("frlogin.en");
private static final String TW_LOGIN_HTML = SiteCenter.getInstance().acquireUrlByKind("frlogin.tw");
private static final String JP_LOGIN_HTML = SiteCenter.getInstance().acquireUrlByKind("frlogin.jp");
private UITextField keyTextField; private UITextField keyTextField;
private DescriptionTextArea descriptionTextArea; private DescriptionTextArea descriptionTextArea;

5
designer_base/src/com/fr/design/actions/help/alphafine/AlphaFineConfigManager.java

@ -202,10 +202,7 @@ public class AlphaFineConfigManager implements XMLable {
} }
public boolean isEnabled() { public boolean isEnabled() {
if (VT4FR.isLicAvailable(FRCoreContext.getBytes()) && VT4FR.ALPHA_FINE.support()) { return isEnabled;
return isEnabled;
}
return false;
} }
public void setEnabled(boolean isEnabled) { public void setEnabled(boolean isEnabled) {

34
designer_base/src/com/fr/design/condition/LiteConditionPane.java

@ -4,7 +4,6 @@ import com.fr.base.BaseUtils;
import com.fr.base.Formula; import com.fr.base.Formula;
import com.fr.data.DataConstants; import com.fr.data.DataConstants;
import com.fr.data.condition.*; import com.fr.data.condition.*;
import com.fr.data.core.Compare;
import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.BasicBeanPane;
import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.formula.FormulaFactory; import com.fr.design.formula.FormulaFactory;
@ -67,6 +66,9 @@ public abstract class LiteConditionPane<T extends Condition> extends BasicBeanPa
private UIButton moveDownButton; private UIButton moveDownButton;
private UIButton bracketButton; private UIButton bracketButton;
private UIButton unBracketButton; private UIButton unBracketButton;
private static final int DOWN_PADDING = 4;
private static final int STRUT_ONE = 35;
private static final int STRUT_TWO = 4;
private ActionListener actionListener1 = new ActionListener() { private ActionListener actionListener1 = new ActionListener() {
@ -76,7 +78,7 @@ public abstract class LiteConditionPane<T extends Condition> extends BasicBeanPa
String text = formulaTextArea.getText(); String text = formulaTextArea.getText();
if (text == null || text.length() <= 0) { if (text == null || text.length() <= 0) {
formula = new Formula(""); formula = new Formula(StringUtils.EMPTY);
} else { } else {
formula = new Formula(text); formula = new Formula(text);
} }
@ -89,7 +91,7 @@ public abstract class LiteConditionPane<T extends Condition> extends BasicBeanPa
public void doOk() { public void doOk() {
Formula formula = formulaPane.update(); Formula formula = formulaPane.update();
if (formula.getContent().length() <= 1) {// 如果没有填任何字符,则是空白文本 if (formula.getContent().length() <= 1) {// 如果没有填任何字符,则是空白文本
formulaTextArea.setText(""); formulaTextArea.setText(StringUtils.EMPTY);
} else { } else {
formulaTextArea.setText(formula.getContent().substring(1)); formulaTextArea.setText(formula.getContent().substring(1));
} }
@ -487,11 +489,11 @@ public abstract class LiteConditionPane<T extends Condition> extends BasicBeanPa
UILabel conditionTypeLabel = new UILabel(Inter.getLocText("FR-Designer_Type") + ":"); UILabel conditionTypeLabel = new UILabel(Inter.getLocText("FR-Designer_Type") + ":");
conditonTypePane.add(conditionTypeLabel, BorderLayout.WEST); conditonTypePane.add(conditionTypeLabel, BorderLayout.WEST);
conditionTypeLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 4, 0)); conditionTypeLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, DOWN_PADDING, 0));
JPanel northPane = FRGUIPaneFactory.createNColumnGridInnerContainer_S_Pane(2); JPanel northPane = FRGUIPaneFactory.createNColumnGridInnerContainer_S_Pane(2);
conditonTypePane.add(northPane, BorderLayout.CENTER); conditonTypePane.add(northPane, BorderLayout.CENTER);
northPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 4, 0)); northPane.setBorder(BorderFactory.createEmptyBorder(0, 0, DOWN_PADDING, 0));
northPane.add(GUICoreUtils.createFlowPane(commonRadioButton, FlowLayout.CENTER)); northPane.add(GUICoreUtils.createFlowPane(commonRadioButton, FlowLayout.CENTER));
northPane.add(GUICoreUtils.createFlowPane(formulaRadioButton, FlowLayout.CENTER)); northPane.add(GUICoreUtils.createFlowPane(formulaRadioButton, FlowLayout.CENTER));
commonRadioButton.addActionListener(radioActionListener); commonRadioButton.addActionListener(radioActionListener);
@ -549,14 +551,14 @@ public abstract class LiteConditionPane<T extends Condition> extends BasicBeanPa
radioPane.add(andRadioButton); radioPane.add(andRadioButton);
radioPane.add(orRadioButton); radioPane.add(orRadioButton);
addControlPane.add(Box.createHorizontalStrut(35)); addControlPane.add(Box.createHorizontalStrut(STRUT_ONE));
addButton = new UIButton(Inter.getLocText("FR-Designer_Add"), BaseUtils.readIcon("com/fr/base/images/cell/control/add.png")); addButton = new UIButton(Inter.getLocText("FR-Designer_Add"), BaseUtils.readIcon("com/fr/base/images/cell/control/add.png"));
addButton.setMnemonic('A'); addButton.setMnemonic('A');
addControlPane.add(addButton); addControlPane.add(addButton);
addButton.addActionListener(actionListener2); addButton.addActionListener(actionListener2);
addControlPane.add(Box.createHorizontalStrut(4)); addControlPane.add(Box.createHorizontalStrut(STRUT_TWO));
modifyButton = new UIButton(Inter.getLocText("FR-Designer_Modify"), BaseUtils.readIcon("com/fr/base/images/cell/control/rename.png")); modifyButton = new UIButton(Inter.getLocText("FR-Designer_Modify"), BaseUtils.readIcon("com/fr/base/images/cell/control/rename.png"));
modifyButton.setMnemonic('M'); modifyButton.setMnemonic('M');
@ -844,7 +846,7 @@ public abstract class LiteConditionPane<T extends Condition> extends BasicBeanPa
*/ */
@Override @Override
public void populateBean(Condition liteCondition) { public void populateBean(Condition liteCondition) {
if(liteCondition == null){ if (liteCondition == null){
return; return;
} }
// peter: 先删除所有的节点 // peter: 先删除所有的节点
@ -854,7 +856,7 @@ public abstract class LiteConditionPane<T extends Condition> extends BasicBeanPa
rootTreeNode.removeAllChildren(); rootTreeNode.removeAllChildren();
// 清空编辑框 // 清空编辑框
defaultConditionPane.populateBean((T)new ObjectCondition(new Compare(Compare.EQUALS, StringUtils.EMPTY))); clearDefaultConditionPane();
formulaTextArea.setText(StringUtils.EMPTY); formulaTextArea.setText(StringUtils.EMPTY);
// peter:需要构建成ListCondition,加入到里面. // peter:需要构建成ListCondition,加入到里面.
@ -870,7 +872,7 @@ public abstract class LiteConditionPane<T extends Condition> extends BasicBeanPa
for (int i = 0; i < joinConditionCount; i++) { for (int i = 0; i < joinConditionCount; i++) {
addLiteConditionToListCondition(rootTreeNode, listCondition.getJoinCondition(i)); addLiteConditionToListCondition(rootTreeNode, listCondition.getJoinCondition(i));
} }
} else if (needDoWithCondition(liteCondition)) { } else if (isNeedDoWithCondition(liteCondition)) {
// peter:直接添加 // peter:直接添加
ExpandMutableTreeNode newTreeNode = new ExpandMutableTreeNode(new JoinCondition(DataConstants.AND, liteCondition)); ExpandMutableTreeNode newTreeNode = new ExpandMutableTreeNode(new JoinCondition(DataConstants.AND, liteCondition));
rootTreeNode.add(newTreeNode); rootTreeNode.add(newTreeNode);
@ -892,7 +894,11 @@ public abstract class LiteConditionPane<T extends Condition> extends BasicBeanPa
} }
} }
protected boolean needDoWithCondition(Condition liteCondition) { // 有需要再重写,不用做成抽象方法
protected void clearDefaultConditionPane() {
}
protected boolean isNeedDoWithCondition(Condition liteCondition) {
return true; return true;
} }
@ -931,12 +937,10 @@ public abstract class LiteConditionPane<T extends Condition> extends BasicBeanPa
// peter: 如果只有一个孩子节点, 返回空的 ListCondition // peter: 如果只有一个孩子节点, 返回空的 ListCondition
if (childCount == 0) { if (childCount == 0) {
return new ListCondition(); return new ListCondition();
} // peter: 如果roottreeNode只有一个孩子节点. } else if (childCount == 1) { // peter: 如果roottreeNode只有一个孩子节点.
else if (childCount == 1) {
JoinCondition joinCondition = (JoinCondition) ((ExpandMutableTreeNode) rootTreeNode.getChildAt(0)).getUserObject(); JoinCondition joinCondition = (JoinCondition) ((ExpandMutableTreeNode) rootTreeNode.getChildAt(0)).getUserObject();
return joinCondition.getCondition(); return joinCondition.getCondition();
} // peter: 有好多的孩子节点. } else { // peter: 有好多的孩子节点.
else {
// peter:深度遍历所有的孩子节点 // peter:深度遍历所有的孩子节点
Enumeration depthEnumeration = rootTreeNode.depthFirstEnumeration(); Enumeration depthEnumeration = rootTreeNode.depthFirstEnumeration();
while (depthEnumeration.hasMoreElements()) { while (depthEnumeration.hasMoreElements()) {

8
designer_base/src/com/fr/design/condition/ObjectLiteConditionPane.java

@ -20,6 +20,7 @@ import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.editor.ValueEditorPane; import com.fr.design.editor.ValueEditorPane;
import com.fr.design.editor.ValueEditorPaneFactory; import com.fr.design.editor.ValueEditorPaneFactory;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.stable.StringUtils;
public class ObjectLiteConditionPane extends LiteConditionPane<ObjectCondition> { public class ObjectLiteConditionPane extends LiteConditionPane<ObjectCondition> {
@ -33,6 +34,11 @@ public class ObjectLiteConditionPane extends LiteConditionPane<ObjectCondition>
return VariableResolver.DEFAULT; return VariableResolver.DEFAULT;
} }
@Override
protected void clearDefaultConditionPane() {
defaultConditionPane.populateBean(new ObjectCondition(new Compare(Compare.EQUALS, StringUtils.EMPTY)));
}
private class ObjectConditionPane extends BasicBeanPane<ObjectCondition> { private class ObjectConditionPane extends BasicBeanPane<ObjectCondition> {
private UIComboBox conditionOPComboBox; private UIComboBox conditionOPComboBox;
@ -68,7 +74,7 @@ public class ObjectLiteConditionPane extends LiteConditionPane<ObjectCondition>
conditionValuePane = ValueEditorPaneFactory.createAllValueEditorPane(); conditionValuePane = ValueEditorPaneFactory.createAllValueEditorPane();
Component[][] components = { { new UILabel(Inter.getLocText("ConditionB-Operator") + ":"), new UILabel() }, Component[][] components = { { new UILabel(Inter.getLocText("FR-Designer_ConditionB-Operator") + ":"), new UILabel() },
{ conditionOPComboBox, conditionValuePane } }; { conditionOPComboBox, conditionValuePane } };
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;

34
designer_base/src/com/fr/design/extra/PluginStoreConstants.java

@ -1,34 +0,0 @@
package com.fr.design.extra;
import com.fr.base.FRContext;
import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils;
import java.io.FileInputStream;
import java.util.Properties;
/**
* Created by vito on 16/4/22.
*/
public class PluginStoreConstants {
public static final String VERSION = loadAttribute("VERSION", "");
private static Properties PROP = null;
private static String loadAttribute(String key, String defaultValue) {
if (PROP == null) {
PROP = new Properties();
try {
PROP.load(new FileInputStream(StableUtils.pathJoin(FRContext.getCurrentEnv().getWebReportPath(), "scripts/store/web/plugin_store.properties")));
} catch (Exception e) {
}
}
String p = PROP.getProperty(key);
if (StringUtils.isEmpty(p)) {
p = defaultValue;
}
return p;
}
}

7
designer_base/src/com/fr/design/extra/WebViewDlgHelper.java

@ -1,7 +1,6 @@
package com.fr.design.extra; package com.fr.design.extra;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.design.RestartHelper;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.UIDialog; import com.fr.design.dialog.UIDialog;
import com.fr.design.gui.frpane.UITabbedPane; import com.fr.design.gui.frpane.UITabbedPane;
@ -12,6 +11,7 @@ import com.fr.general.Inter;
import com.fr.general.SiteCenter; import com.fr.general.SiteCenter;
import com.fr.general.http.HttpClient; import com.fr.general.http.HttpClient;
import com.fr.json.JSONObject; import com.fr.json.JSONObject;
import com.fr.plugin.PluginStoreConstants;
import com.fr.plugin.PluginVerifyException; import com.fr.plugin.PluginVerifyException;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
@ -55,8 +55,8 @@ public class WebViewDlgHelper {
String indexPath = "index.html"; String indexPath = "index.html";
String mainIndexPath = StableUtils.pathJoin(installHome, indexPath); String mainIndexPath = StableUtils.pathJoin(installHome, indexPath);
checkAndCopyMainFile(mainIndexPath, mainJsPath); checkAndCopyMainFile(mainIndexPath, mainJsPath);
updateShopScripts(SHOP_SCRIPTS);
showPluginDlg(mainIndexPath); showPluginDlg(mainIndexPath);
updateShopScripts(SHOP_SCRIPTS);
} }
} else { } else {
BasicPane traditionalStorePane = new BasicPane() { BasicPane traditionalStorePane = new BasicPane() {
@ -195,6 +195,7 @@ public class WebViewDlgHelper {
IOUtils.unzip(new File(StableUtils.pathJoin(PluginConstants.DOWNLOAD_PATH, PluginConstants.TEMP_FILE)), installHome); IOUtils.unzip(new File(StableUtils.pathJoin(PluginConstants.DOWNLOAD_PATH, PluginConstants.TEMP_FILE)), installHome);
copyMainFile(StableUtils.pathJoin(installHome, "index.html"), StableUtils.pathJoin(installHome, relativePath)); copyMainFile(StableUtils.pathJoin(installHome, "index.html"), StableUtils.pathJoin(installHome, relativePath));
// TODO: 2017/4/17 删除之前存放在安装目录下的script // TODO: 2017/4/17 删除之前存放在安装目录下的script
PluginStoreConstants.refreshProps(); // 下载完刷新一下版本号等
JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer-Plugin_Shop_Installed"), Inter.getLocText("FR-Designer_Tooltips"), JOptionPane.INFORMATION_MESSAGE); JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer-Plugin_Shop_Installed"), Inter.getLocText("FR-Designer_Tooltips"), JOptionPane.INFORMATION_MESSAGE);
} }
} catch (InterruptedException | ExecutionException e) { } catch (InterruptedException | ExecutionException e) {
@ -209,7 +210,7 @@ public class WebViewDlgHelper {
new SwingWorker<Void, Void>() { new SwingWorker<Void, Void>() {
@Override @Override
protected Void doInBackground() throws Exception { protected Void doInBackground() throws Exception {
HttpClient httpClient = new HttpClient(SiteCenter.getInstance().acquireUrlByKind("shop.plugin.cv") + "&version=" + PluginStoreConstants.VERSION); HttpClient httpClient = new HttpClient(SiteCenter.getInstance().acquireUrlByKind("shop.plugin.cv") + "&version=" + PluginStoreConstants.getInstance().getProps("VERSION"));
httpClient.asGet(); httpClient.asGet();
if (httpClient.getResponseCode() == HttpURLConnection.HTTP_OK) { if (httpClient.getResponseCode() == HttpURLConnection.HTTP_OK) {
String text = httpClient.getResponseText(); String text = httpClient.getResponseText();

9
designer_base/src/com/fr/design/gui/icontainer/UIScrollPane.java

@ -13,12 +13,13 @@ import java.awt.*;
public class UIScrollPane extends JScrollPane { public class UIScrollPane extends JScrollPane {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private static final int INCREAMENT = 30;
public UIScrollPane(Component c) { public UIScrollPane(Component c) {
super(c, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); super(c, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
this.setHorizontalScrollBar(createHorizontalScrollBar()); this.setHorizontalScrollBar(createHorizontalScrollBar());
this.getVerticalScrollBar().setUnitIncrement(30); this.getVerticalScrollBar().setUnitIncrement(INCREAMENT);
this.getVerticalScrollBar().setBlockIncrement(30); this.getVerticalScrollBar().setBlockIncrement(INCREAMENT);
this.getHorizontalScrollBar().setOpaque(true); this.getHorizontalScrollBar().setOpaque(true);
this.getHorizontalScrollBar().setBackground(Color.WHITE); this.getHorizontalScrollBar().setBackground(Color.WHITE);
this.getVerticalScrollBar().setOpaque(true); this.getVerticalScrollBar().setOpaque(true);
@ -29,7 +30,7 @@ public class UIScrollPane extends JScrollPane {
/** /**
* 生成水平滚动条 * 生成水平滚动条
*/ */
public JScrollBar createHorizontalScrollBar() { public UIScrollBar createHorizontalScrollBar() {
UIScrollBar sbr = new UIScrollBar(JScrollBar.HORIZONTAL); UIScrollBar sbr = new UIScrollBar(JScrollBar.HORIZONTAL);
sbr.setBackground(UIConstants.NORMAL_BACKGROUND); sbr.setBackground(UIConstants.NORMAL_BACKGROUND);
return sbr; return sbr;
@ -39,7 +40,7 @@ public class UIScrollPane extends JScrollPane {
/** /**
* 生成垂直滚动条 * 生成垂直滚动条
*/ */
public JScrollBar createVerticalScrollBar() { public UIScrollBar createVerticalScrollBar() {
UIScrollBar sbr = new UIScrollBar(JScrollBar.VERTICAL); UIScrollBar sbr = new UIScrollBar(JScrollBar.VERTICAL);
sbr.setBackground(UIConstants.NORMAL_BACKGROUND); sbr.setBackground(UIConstants.NORMAL_BACKGROUND);
return sbr; return sbr;

2
designer_base/src/com/fr/design/locale/designer_en_US.properties

@ -659,7 +659,7 @@ FRFont-Subscript=Subscript
Background_Settings=Background Settings Background_Settings=Background Settings
FormulaD-Invalid_Formula=Invalid Formula FormulaD-Invalid_Formula=Invalid Formula
FR-Base_Margin=Margin FR-Base_Margin=Margin
FR-Designer-Plugin_Shop_Installed=Plug-shop installed, whether to start immediately? FR-Designer-Plugin_Shop_Installed=Plugin store is installed, please reopen the store.
M_Edit-Send_to_Back=Send to Bottom M_Edit-Send_to_Back=Send to Bottom
Email-Can_Preview_Report_Content=Preview Report Content in the Body Email-Can_Preview_Report_Content=Preview Report Content in the Body
FR-Designer-FRFont_Italic=Italic FR-Designer-FRFont_Italic=Italic

2
designer_base/src/com/fr/design/locale/designer_ja_JP.properties

@ -657,7 +657,7 @@ FRFont-Subscript=\u4E0B\u4ED8\u304D
Background_Settings=\u80CC\u666F\u8A2D\u5B9A Background_Settings=\u80CC\u666F\u8A2D\u5B9A
FormulaD-Invalid_Formula=\u7121\u52B9\u306A\u516C\u5F0F FormulaD-Invalid_Formula=\u7121\u52B9\u306A\u516C\u5F0F
FR-Base_Margin=\u30DE\u30FC\u30B8\u30F3 FR-Base_Margin=\u30DE\u30FC\u30B8\u30F3
FR-Designer-Plugin_Shop_Installed=\u30D7\u30E9\u30B0\u30A4\u30F3\u30B7\u30E7\u30C3\u30D7\u304C\u3059\u3050\u306B\u958B\u59CB\u3059\u308B\u304B\u3069\u3046\u304B\u3001\u30A4\u30F3\u30B9\u30C8\u30FC\u30EB\u3055\u308C\u3066\u3044\u307E\u3059\u304B\uFF1F FR-Designer-Plugin_Shop_Installed=
M_Edit-Send_to_Back=\u6700\u80CC\u9762\u3078\u79FB\u52D5(K) M_Edit-Send_to_Back=\u6700\u80CC\u9762\u3078\u79FB\u52D5(K)
Email-Can_Preview_Report_Content=\u30C6\u30AD\u30B9\u30C8\u30D7\u30EC\u30D3\u30E5\u30FC\u30EC\u30DD\u30FC\u30C8\u306E\u5185\u5BB9 Email-Can_Preview_Report_Content=\u30C6\u30AD\u30B9\u30C8\u30D7\u30EC\u30D3\u30E5\u30FC\u30EC\u30DD\u30FC\u30C8\u306E\u5185\u5BB9
FR-Designer-FRFont_Italic=\u50BE\u659C FR-Designer-FRFont_Italic=\u50BE\u659C

2
designer_base/src/com/fr/design/locale/designer_ko_KR.properties

@ -657,7 +657,7 @@ FRFont-Subscript=\uBC11\uC904
Background_Settings=\uBC30\uACBD\uC124\uC815 Background_Settings=\uBC30\uACBD\uC124\uC815
FormulaD-Invalid_Formula=\uC62C\uBC14\uB974\uC9C0\uC54A\uC740\uC218\uC2DD FormulaD-Invalid_Formula=\uC62C\uBC14\uB974\uC9C0\uC54A\uC740\uC218\uC2DD
FR-Base_Margin=\uC5EC\uBC31 FR-Base_Margin=\uC5EC\uBC31
FR-Designer-Plugin_Shop_Installed=\uD50C\uB7EC\uADF8\uC778 \uC0C1\uC810 \uC989\uC2DC \uC2DC\uC791\uD560\uC9C0 \uC5EC\uBD80\uB97C \uC124\uCE58? FR-Designer-Plugin_Shop_Installed=
M_Edit-Send_to_Back=\uC81C\uC77C\uBC11\uC5D0\uB450\uAE30(K) M_Edit-Send_to_Back=\uC81C\uC77C\uBC11\uC5D0\uB450\uAE30(K)
Email-Can_Preview_Report_Content=\uBCF8\uBB38\uBBF8\uB9AC\uBCF4\uAE30\uBB38\uC11C\uB0B4\uC6A9 Email-Can_Preview_Report_Content=\uBCF8\uBB38\uBBF8\uB9AC\uBCF4\uAE30\uBB38\uC11C\uB0B4\uC6A9
FR-Designer-FRFont_Italic=\uAE30\uC6B8\uC784\uAF34 FR-Designer-FRFont_Italic=\uAE30\uC6B8\uC784\uAF34

2
designer_base/src/com/fr/design/locale/designer_zh_CN.properties

@ -660,7 +660,7 @@ FRFont-Subscript=\u4E0B\u6807
Background_Settings=\u80CC\u666F\u8BBE\u7F6E Background_Settings=\u80CC\u666F\u8BBE\u7F6E
FormulaD-Invalid_Formula=\u975E\u6CD5\u7684\u516C\u5F0F FormulaD-Invalid_Formula=\u975E\u6CD5\u7684\u516C\u5F0F
FR-Base_Margin=\u8FB9\u8DDD FR-Base_Margin=\u8FB9\u8DDD
FR-Designer-Plugin_Shop_Installed=\u63D2\u4EF6\u5546\u5E97\u5B89\u88C5\u5B8C\u6BD5,\u662F\u5426\u7ACB\u523B\u542F\u52A8? FR-Designer-Plugin_Shop_Installed=\u63D2\u4EF6\u5546\u5E97\u5B89\u88C5\u5B8C\u6BD5,\u8BF7\u91CD\u65B0\u6253\u5F00\u63D2\u4EF6\u5546\u5E97\u3002
M_Edit-Send_to_Back=\u7F6E\u4E8E\u5E95\u5C42(K) M_Edit-Send_to_Back=\u7F6E\u4E8E\u5E95\u5C42(K)
Email-Can_Preview_Report_Content=\u6B63\u6587\u9884\u89C8\u62A5\u8868\u5185\u5BB9 Email-Can_Preview_Report_Content=\u6B63\u6587\u9884\u89C8\u62A5\u8868\u5185\u5BB9
FR-Designer-FRFont_Italic=\u503E\u659C FR-Designer-FRFont_Italic=\u503E\u659C

2
designer_base/src/com/fr/design/locale/designer_zh_TW.properties

@ -659,7 +659,7 @@ FRFont-Subscript=\u4E0B\u6A19
Background_Settings=\u80CC\u666F\u8A2D\u5B9A Background_Settings=\u80CC\u666F\u8A2D\u5B9A
FormulaD-Invalid_Formula=\u975E\u6CD5\u7684\u516C\u5F0F FormulaD-Invalid_Formula=\u975E\u6CD5\u7684\u516C\u5F0F
FR-Base_Margin=\u908A\u8DDD FR-Base_Margin=\u908A\u8DDD
FR-Designer-Plugin_Shop_Installed=\u63D2\u4EF6\u5546\u5E97\u5B89\u88DD\u5B8C\u7562,\u662F\u5426\u7ACB\u523B\u555F\u52D5? FR-Designer-Plugin_Shop_Installed=\u63D2\u4EF6\u5546\u5E97\u5B89\u88DD\u5B8C\u7562,\u8ACB\u91CD\u65B0\u6253\u958B\u63D2\u4EF6\u5546\u5E97\u3002
M_Edit-Send_to_Back=\u7F6E\u65BC\u5E95\u5C64(K) M_Edit-Send_to_Back=\u7F6E\u65BC\u5E95\u5C64(K)
Email-Can_Preview_Report_Content=\u6B63\u6587\u9810\u89BD\u5831\u8868\u5167\u5BB9 Email-Can_Preview_Report_Content=\u6B63\u6587\u9810\u89BD\u5831\u8868\u5167\u5BB9
FR-Designer-FRFont_Italic=\u659C\u9AD4 FR-Designer-FRFont_Italic=\u659C\u9AD4

6
designer_base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java

@ -381,10 +381,8 @@ public abstract class ToolBarMenuDock {
// shortCuts.add(new ForumAction()); // shortCuts.add(new ForumAction());
} }
shortCuts.add(SeparatorDef.DEFAULT); shortCuts.add(SeparatorDef.DEFAULT);
if (VT4FR.isLicAvailable(FRCoreContext.getBytes()) && VT4FR.ALPHA_FINE.support()) { shortCuts.add(new AlphaFineAction());
shortCuts.add(new AlphaFineAction()); shortCuts.add(SeparatorDef.DEFAULT);
shortCuts.add(SeparatorDef.DEFAULT);
}
shortCuts.add(new AboutAction()); shortCuts.add(new AboutAction());
return shortCuts.toArray(new ShortCut[shortCuts.size()]); return shortCuts.toArray(new ShortCut[shortCuts.size()]);
} }

4
designer_base/src/com/fr/design/scrollruler/HorizontalRulerUI.java

@ -12,6 +12,7 @@ import com.fr.base.GraphHelper;
import com.fr.base.ScreenResolution; import com.fr.base.ScreenResolution;
import com.fr.base.Style; import com.fr.base.Style;
import com.fr.base.Utils; import com.fr.base.Utils;
import com.fr.design.file.HistoryTemplateListPane;
public class HorizontalRulerUI extends RulerUI { public class HorizontalRulerUI extends RulerUI {
@ -25,7 +26,8 @@ public class HorizontalRulerUI extends RulerUI {
for (int i = k; i < (pxToLength(size.getWidth() + extra) + 1) * ratio; i++) { for (int i = k; i < (pxToLength(size.getWidth() + extra) + 1) * ratio; i++) {
g.setColor(BaseRuler.UNIT_SIGN_COLOR); g.setColor(BaseRuler.UNIT_SIGN_COLOR);
if (i % BaseRuler.SCALE_10 == 0) { if (i % BaseRuler.SCALE_10 == 0) {
String text = Utils.convertNumberStringToString(i / showText); double times = (double)HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getJTemplateResolution() / ScreenResolution.getScreenResolution();
String text = Utils.convertNumberStringToString(Math.round(i / times));
Graphics2D gg = (Graphics2D) g.create((int) (toPX(i) / ratio) - extra + 1, 0, BaseRuler.NUMBER_100, size.height); Graphics2D gg = (Graphics2D) g.create((int) (toPX(i) / ratio) - extra + 1, 0, BaseRuler.NUMBER_100, size.height);
BaseUtils.drawStringStyleInRotation(gg, BaseRuler.NUMBER_100, BaseRuler.NUMBER_14, text, Style.getInstance().deriveHorizontalAlignment( BaseUtils.drawStringStyleInRotation(gg, BaseRuler.NUMBER_100, BaseRuler.NUMBER_14, text, Style.getInstance().deriveHorizontalAlignment(
Style.LEFT_TO_RIGHT).deriveFRFont(BaseRuler.TEXT_FONT), ScreenResolution.getScreenResolution()); Style.LEFT_TO_RIGHT).deriveFRFont(BaseRuler.TEXT_FONT), ScreenResolution.getScreenResolution());

4
designer_base/src/com/fr/design/scrollruler/VerticalRulerUI.java

@ -9,6 +9,7 @@ import com.fr.base.GraphHelper;
import com.fr.base.ScreenResolution; import com.fr.base.ScreenResolution;
import com.fr.base.Style; import com.fr.base.Style;
import com.fr.base.Utils; import com.fr.base.Utils;
import com.fr.design.file.HistoryTemplateListPane;
public class VerticalRulerUI extends RulerUI{ public class VerticalRulerUI extends RulerUI{
@ -22,8 +23,9 @@ public class VerticalRulerUI extends RulerUI{
for (int i = k; i < (pxToLength(size.height + extra) + 1) * ratio; i++) { for (int i = k; i < (pxToLength(size.height + extra) + 1) * ratio; i++) {
g.setColor(BaseRuler.UNIT_SIGN_COLOR); g.setColor(BaseRuler.UNIT_SIGN_COLOR);
if (i % BaseRuler.SCALE_10 == 0) { if (i % BaseRuler.SCALE_10 == 0) {
double times = (double) HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getJTemplateResolution() / ScreenResolution.getScreenResolution();
String text = Utils.convertNumberStringToString(Math.round(i / times));
GraphHelper.drawLine(g, size.width, toPX(i) / ratio - extra, 0, toPX(i) / ratio - extra); GraphHelper.drawLine(g, size.width, toPX(i) / ratio - extra, 0, toPX(i) / ratio - extra);
String text = Utils.convertNumberStringToString(i / showText);
Graphics2D gg = (Graphics2D) g.create(0, (int) (toPX(i) / ratio - extra + 1), size.width, BaseRuler.NUMBER_99); Graphics2D gg = (Graphics2D) g.create(0, (int) (toPX(i) / ratio - extra + 1), size.width, BaseRuler.NUMBER_99);
BaseUtils.drawStringStyleInRotation(gg, BaseRuler.NUMBER_11, BaseRuler.NUMBER_100, text, Style.getInstance().deriveVerticalAlignment(1).deriveRotation( BaseUtils.drawStringStyleInRotation(gg, BaseRuler.NUMBER_11, BaseRuler.NUMBER_100, text, Style.getInstance().deriveVerticalAlignment(1).deriveRotation(
BaseRuler.NUMBER_90).deriveFRFont(BaseRuler.TEXT_FONT), ScreenResolution.getScreenResolution()); BaseRuler.NUMBER_90).deriveFRFont(BaseRuler.TEXT_FONT), ScreenResolution.getScreenResolution());

191
designer_base/src/com/fr/design/web/CustomIconPane.java

@ -7,7 +7,9 @@ import com.fr.base.IconManager;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.iscrollbar.UIScrollBar;
import com.fr.design.gui.itextarea.DescriptionTextArea; import com.fr.design.gui.itextarea.DescriptionTextArea;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
@ -26,6 +28,7 @@ import javax.swing.*;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
import javax.swing.filechooser.FileNameExtensionFilter; import javax.swing.filechooser.FileNameExtensionFilter;
import javax.swing.plaf.basic.BasicButtonUI;
import java.awt.*; import java.awt.*;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
@ -44,14 +47,14 @@ public class CustomIconPane extends BasicPane {
private ListMap iconButtonMap = null; private ListMap iconButtonMap = null;
private JPanel iconPane = null; private JPanel iconPane = null;
private ButtonGroup bg; private ButtonGroup bg;
private JScrollPane jsPane; private UIScrollPane jsPane;
// 老一次次去拿真麻烦 // 老一次次去拿真麻烦
private IconManager iconManager = null; private IconManager iconManager = null;
private int width = 180; private static final int THE_WIDTH = 180;
private int horizontalCount = 6; private static final int HORIZONTAL_COUNT = 6;
private int heightPer = 29; private static final int HEIGHT_PER = 29;
private int gap = 10; private static final int GAP = 10;
public CustomIconPane() { public CustomIconPane() {
this.initComponents(); this.initComponents();
@ -69,7 +72,7 @@ public class CustomIconPane extends BasicPane {
// 开始加图标选择按钮 // 开始加图标选择按钮
initIcons(); initIcons();
jsPane = new JScrollPane(iconPane); jsPane = new UIScrollPane(iconPane);
refreshIconPane(false); refreshIconPane(false);
jsPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); jsPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
@ -131,14 +134,11 @@ public class CustomIconPane extends BasicPane {
if (iconManager.addIcon(icon, false)) { if (iconManager.addIcon(icon, false)) {
IconButton iconButton = null;//初始化 IconButton iconButton = null;//初始化
addIcon(icon,iconButton); addIcon(icon, iconButton);
}else { }else {
// add failed // add failed
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Inter.getLocText("FR-Designer_Custom_Icon_Message2"), Inter.getLocText("FR-Designer_Tooltips"), JOptionPane.WARNING_MESSAGE);
Inter.getLocText("FR-Designer_Custom_Icon_Message2"),
Inter.getLocText("FR-Designer_Tooltips"),
JOptionPane.WARNING_MESSAGE);
} }
} }
}).setVisible(true); }).setVisible(true);
@ -189,6 +189,7 @@ public class CustomIconPane extends BasicPane {
try { try {
oldIcon= iconManager.getIcon(selectedIconName); oldIcon= iconManager.getIcon(selectedIconName);
} catch (CloneNotSupportedException e1) { } catch (CloneNotSupportedException e1) {
// do nothing
} }
if (oldIcon == null) { if (oldIcon == null) {
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(),
@ -209,16 +210,13 @@ public class CustomIconPane extends BasicPane {
iconPane.remove(iconButton); iconPane.remove(iconButton);
bg.remove(iconButton); bg.remove(iconButton);
addIcon(icon,iconButton); addIcon(icon, iconButton);
} else { } else {
// 失败了再弄回去 // 失败了再弄回去
iconManager.addIcon(oldIcon, true); iconManager.addIcon(oldIcon, true);
// edit failed // edit failed
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Inter.getLocText("FR-Designer_Custom_Icon_Message2"), Inter.getLocText("FR-Designer_Tooltips"), JOptionPane.WARNING_MESSAGE);
Inter.getLocText("FR-Designer_Custom_Icon_Message2"),
Inter.getLocText("FR-Designer_Tooltips"),
JOptionPane.WARNING_MESSAGE);
} }
} }
}); });
@ -272,8 +270,8 @@ public class CustomIconPane extends BasicPane {
// 不知道怎么动态布局,就这么傻傻的调一下大小 // 不知道怎么动态布局,就这么傻傻的调一下大小
private void refreshIconPane(boolean down) { private void refreshIconPane(boolean down) {
iconPane.setPreferredSize(new Dimension(width, (iconButtonMap.size() / horizontalCount + 1) * heightPer + gap)); iconPane.setPreferredSize(new Dimension(THE_WIDTH, (iconButtonMap.size() / HORIZONTAL_COUNT + 1) * HEIGHT_PER + GAP));
JScrollBar jsBar = jsPane.getVerticalScrollBar(); UIScrollBar jsBar = jsPane.createVerticalScrollBar();
try { try {
if (down) { if (down) {
// 将滚动条滚到最后 // 将滚动条滚到最后
@ -282,29 +280,41 @@ public class CustomIconPane extends BasicPane {
jsBar.setValue(0); jsBar.setValue(0);
} }
} catch (RuntimeException re) { } catch (RuntimeException re) {
return;
} }
} }
private class IconButton extends JToggleButton implements ActionListener{ private class IconButton extends JToggleButton implements ActionListener{
private String iconName; private String iconName;
private Image iconImage = null; private Image iconImage = null;
private static final int ICON_BUTTON_SIZE = 24;
private static final int ICON_X = 4;
private static final int ICON_Y = 4;
public IconButton(String name) { public IconButton(String name) {
this.iconName = name; this.iconName = name;
this.addActionListener(this); this.addActionListener(this);
this.setCursor(new Cursor(Cursor.HAND_CURSOR)); this.setCursor(new Cursor(Cursor.HAND_CURSOR));
this.setBorder(null); this.setBorder(null);
this.iconImage = WidgetManager.getProviderInstance().getIconManager().getIconImage(name); this.iconImage = WidgetManager.getProviderInstance().getIconManager().getIconImage(name);
this.setToolTipText(iconName); this.setToolTipText(iconName);
} }
@Override
public void updateUI() {
setUI(new BasicButtonUI(){
public void paint(Graphics g, JComponent c) {
super.paint(g, c);
}
});
}
@Override @Override
public void paintComponent(Graphics g) { public void paintComponent(Graphics g) {
super.paintComponent(g);
Graphics2D g2d = (Graphics2D) g; Graphics2D g2d = (Graphics2D) g;
// carl:这里缩放显示 16 × 16 // carl:这里缩放显示 16 × 16
if (iconImage != null) { if (iconImage != null) {
g2d.drawImage(iconImage, 4, 4, IconManager.DEFAULT_ICONWIDTH, IconManager.DEFAULT_ICONHEIGHT, null); g2d.drawImage(iconImage, ICON_X, ICON_Y, IconManager.DEFAULT_ICONWIDTH, IconManager.DEFAULT_ICONHEIGHT, null);
} }
if (this.iconName != null && ComparatorUtils.equals(this.iconName, selectedIconName)) { if (this.iconName != null && ComparatorUtils.equals(this.iconName, selectedIconName)) {
g2d.setPaint(Color.RED); g2d.setPaint(Color.RED);
@ -317,7 +327,7 @@ public class CustomIconPane extends BasicPane {
@Override @Override
public Dimension getPreferredSize() { public Dimension getPreferredSize() {
return new Dimension(24, 24); return new Dimension(ICON_BUTTON_SIZE, ICON_BUTTON_SIZE);
} }
public void actionPerformed(ActionEvent evt) { public void actionPerformed(ActionEvent evt) {
@ -348,75 +358,80 @@ public class CustomIconPane extends BasicPane {
private String oldName = null; private String oldName = null;
protected EditIconDialog() { protected EditIconDialog() {
this.setLayout(FRGUIPaneFactory.createBorderLayout()); init();
double p = TableLayout.PREFERRED; }
double rowSize[] = {p, p};
double columnSize[] = {p, p, p};
UIButton browseButton = new UIButton(Inter.getLocText("FR-Designer_Custom_Icon_SelectIcon"));
browseButton.setPreferredSize(new java.awt.Dimension(80, 25));
browseButton.setToolTipText(Inter.getLocText("FR-Designer_Click_this_button"));
browseButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
JFileChooser jf = new JFileChooser();
// carl:不知道是否只要png格式,反正导出时全部都转成png了
FileNameExtensionFilter fileFilter = new FileNameExtensionFilter("Icon Image File", "jpg", "jpeg", "png", "gif");
jf.setFileFilter(fileFilter);
if (JFileChooser.APPROVE_OPTION == jf.showOpenDialog(DesignerContext.getDesignerFrame())) { private void init() {
String path = jf.getSelectedFile().getAbsolutePath(); this.setLayout(FRGUIPaneFactory.createBorderLayout());
// 将图片转化到16 × 16大小 double p = TableLayout.PREFERRED;
Image image = BaseUtils.readImage(path); double rowSize[] = {p, p};
BufferedImage bufferedImage = CoreGraphHelper.createBufferedImage(IconManager.DEFAULT_ICONWIDTH, double columnSize[] = {p, p, p};
IconManager.DEFAULT_ICONHEIGHT, BufferedImage.TYPE_INT_ARGB);
Graphics2D g2d = bufferedImage.createGraphics(); UIButton browseButton = new UIButton(Inter.getLocText("FR-Designer_Custom_Icon_SelectIcon"));
g2d.drawImage(image, 0, 0, IconManager.DEFAULT_ICONWIDTH, IconManager.DEFAULT_ICONHEIGHT, null); browseButton.setPreferredSize(new Dimension(80, 25));
bufferedImage.flush(); browseButton.setToolTipText(Inter.getLocText("FR-Designer_Click_this_button"));
g2d.dispose(); nameTextField = new UITextField(20);
iconImage = bufferedImage;
if (iconImage != null) { browseButton.addActionListener(new ActionListener() {
showImageLabel.setIcon(new ImageIcon(iconImage)); public void actionPerformed(ActionEvent e) {
} onBrowseButtonClicked();
}
} }
}); });
nameTextField = new UITextField(20); // 焦点丢失时看看名称是否已经存在
// 焦点丢失时看看名称是否已经存在 nameTextField.addFocusListener(new FocusListener() {
nameTextField.addFocusListener(new FocusListener() { public void focusGained(FocusEvent e) {
public void focusGained(FocusEvent e) { // do nothing
} }
public void focusLost(FocusEvent e) { public void focusLost(FocusEvent e) {
if (oldName != null && ComparatorUtils.equals(oldName, nameTextField.getText())) { if (oldName != null && ComparatorUtils.equals(oldName, nameTextField.getText())) {
return; return;
} }
if (WidgetManager.getProviderInstance().getIconManager().contains(nameTextField.getText())) { if (WidgetManager.getProviderInstance().getIconManager().contains(nameTextField.getText())) {
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(),
Inter.getLocText("FR-Designer_Custom_Icon_Message3"), Inter.getLocText("FR-Designer_Custom_Icon_Message3"),
Inter.getLocText("FR-Designer_Tooltips"), Inter.getLocText("FR-Designer_Tooltips"),
JOptionPane.WARNING_MESSAGE); JOptionPane.WARNING_MESSAGE);
} }
} }
}); });
JPanel imagePane = new JPanel(); JPanel imagePane = new JPanel();
imagePane.setLayout(new FlowLayout(FlowLayout.LEFT, 30, 0)); imagePane.setLayout(new FlowLayout(FlowLayout.LEFT, 30, 0));
showImageLabel = new UILabel(); showImageLabel = new UILabel();
showImageLabel.setPreferredSize(new Dimension(20,20)); showImageLabel.setPreferredSize(new Dimension(20,20));
imagePane.add(showImageLabel); imagePane.add(showImageLabel);
imagePane.add(browseButton); imagePane.add(browseButton);
Component[][] components = { Component[][] components = {{new UILabel(Inter.getLocText("FR-Designer_Name") + ":"), nameTextField}, {new UILabel(Inter.getLocText("FR-Designer_Icon") + ":"), imagePane}};
{new UILabel(Inter.getLocText("FR-Designer_Name") + ":"), nameTextField},
{new UILabel(Inter.getLocText("FR-Designer_Icon") + ":"), imagePane} JPanel centerPane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
}; this.add(centerPane, BorderLayout.CENTER);
}
JPanel centerPane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
this.add(centerPane,BorderLayout.CENTER); private void onBrowseButtonClicked() {
} JFileChooser jf = new JFileChooser();
// carl:不知道是否只要png格式,反正导出时全部都转成png了
@Override FileNameExtensionFilter fileFilter = new FileNameExtensionFilter("Icon Image File", "jpg", "jpeg", "png", "gif");
jf.setFileFilter(fileFilter);
if (JFileChooser.APPROVE_OPTION == jf.showOpenDialog(DesignerContext.getDesignerFrame())) {
String path = jf.getSelectedFile().getAbsolutePath();
// 将图片转化到16 × 16大小
Image image = BaseUtils.readImage(path);
BufferedImage bufferedImage = CoreGraphHelper.createBufferedImage(IconManager.DEFAULT_ICONWIDTH,
IconManager.DEFAULT_ICONHEIGHT, BufferedImage.TYPE_INT_ARGB);
Graphics2D g2d = bufferedImage.createGraphics();
g2d.drawImage(image, 0, 0, IconManager.DEFAULT_ICONWIDTH, IconManager.DEFAULT_ICONHEIGHT, null);
bufferedImage.flush();
g2d.dispose();
iconImage = bufferedImage;
if (iconImage != null) {
showImageLabel.setIcon(new ImageIcon(iconImage));
}
}
}
@Override
protected String title4PopupWindow() { protected String title4PopupWindow() {
return Inter.getLocText(new String[]{"Add", "Icon"}); return Inter.getLocText(new String[]{"Add", "Icon"});
} }

33
designer_form/src/com/fr/design/mainframe/FormArea.java

@ -35,6 +35,7 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
private static final int ROTATIONS = 50; private static final int ROTATIONS = 50;
private static final int SHOWVALMAX = 400; private static final int SHOWVALMAX = 400;
private static final int SHOWVALMIN = 10; private static final int SHOWVALMIN = 10;
private static final int RESIZE_PANE_GAP = 8;
private FormDesigner designer; private FormDesigner designer;
private int horizontalValue = 0; private int horizontalValue = 0;
private int verticalValue = 0; private int verticalValue = 0;
@ -86,8 +87,6 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
} }
this.setFocusTraversalKeysEnabled(false); this.setFocusTraversalKeysEnabled(false);
this.designer.addMouseWheelListener(showValSpinnerMouseWheelListener); this.designer.addMouseWheelListener(showValSpinnerMouseWheelListener);
this.setOpaque(true);
this.setBackground(Color.WHITE);
} }
MouseWheelListener showValSpinnerMouseWheelListener = new MouseWheelListener() { MouseWheelListener showValSpinnerMouseWheelListener = new MouseWheelListener() {
@ -121,11 +120,7 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
slidePane = JFormSliderPane.getInstance(); slidePane = JFormSliderPane.getInstance();
slidePane.setPreferredSize(new Dimension(200, 20)); slidePane.setPreferredSize(new Dimension(200, 20));
JPanel resizePane = TableLayoutHelper.createCommonTableLayoutPane(new JComponent[][]{{ tipsPane, new UILabel(), widthPane, new UILabel(Inter.getLocText("FR-Designer_Indent-Pixel")), new UILabel("x"), heightPane, new UILabel(Inter.getLocText("FR-Designer_Indent-Pixel")), new UILabel(), slidePane }}, rowSize, columnSize, RESIZE_PANE_GAP);
JPanel resizePane = TableLayoutHelper.createCommonTableLayoutPane(new JComponent[][]{
{tipsPane, new UILabel(), widthPane, new UILabel(Inter.getLocText("FR-Designer_Indent-Pixel")), new UILabel("x"),
heightPane, new UILabel(Inter.getLocText("FR-Designer_Indent-Pixel")), new UILabel(), slidePane}},
rowSize, columnSize, 8);
this.add(FormRulerLayout.BOTTOM, resizePane); this.add(FormRulerLayout.BOTTOM, resizePane);
setWidgetsConfig(); setWidgetsConfig();
// 先初始话滑块及对应事件,然后获取分辨率调整容器的显示大小 // 先初始话滑块及对应事件,然后获取分辨率调整容器的显示大小
@ -441,17 +436,20 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
int id = evt.getID(); int id = evt.getID();
switch (id) { switch (id) {
case MouseEvent.MOUSE_WHEEL: { case MouseEvent.MOUSE_WHEEL: {
int rotations = evt.getWheelRotation(); onMouseWheelScroll(evt);
int value = this.verScrollBar.getValue() + rotations * ROTATIONS;
value = Math.min(value, verticalMax);
value = Math.max(0, value);
doLayout(); //加dolayout是因为每次滚动都要重置 Max的大小
this.verScrollBar.setValue(value);
break; break;
} }
default:
} }
} }
private void onMouseWheelScroll(MouseWheelEvent evt) {
int value = this.verScrollBar.getValue() + evt.getWheelRotation() * ROTATIONS;
value = Math.max(0, Math.min(value, verticalMax));
doLayout(); //加dolayout是因为每次滚动都要重置 Max的大小
this.verScrollBar.setValue(value);
}
/** /**
* 返回表单容器的中心designer * 返回表单容器的中心designer
* getFormEditor. * getFormEditor.
@ -745,9 +743,12 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
} }
private class FormRulerLayout extends RulerLayout { private class FormRulerLayout extends RulerLayout {
private int DESIGNERWIDTH = 960; private static final int DESIGNER_WIDTH = 960;
private int DESIGNERHEIGHT = 540; private static final int DESIGNER_HEIGHT = 540;
private int TOPGAP = 8; private static final int TOPGAP = 8;
private int DESIGNERWIDTH = DESIGNER_WIDTH;
private int DESIGNERHEIGHT = DESIGNER_HEIGHT;
public FormRulerLayout() { public FormRulerLayout() {
super(); super();

46
designer_form/src/com/fr/design/mainframe/JForm.java

@ -93,6 +93,8 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm {
@Override @Override
public void refreshEastPropertiesPane() { public void refreshEastPropertiesPane() {
// 暂时用不到,遇到的时候再加刷新右侧tab面板的代码
return;
} }
@Override @Override
@ -126,7 +128,7 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm {
@Override @Override
public void setJTemplateResolution(int resolution) { public void setJTemplateResolution(int resolution) {
return;
} }
@Override @Override
@ -220,7 +222,10 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm {
formDesign = new FormDesigner(this.getTarget(), new TabChangeAction(BaseJForm.ELEMENTCASE_TAB, this)); formDesign = new FormDesigner(this.getTarget(), new TabChangeAction(BaseJForm.ELEMENTCASE_TAB, this));
WidgetToolBarPane.getInstance(formDesign); WidgetToolBarPane.getInstance(formDesign);
FormArea area = new FormArea(formDesign); FormArea area = new FormArea(formDesign);
centerPane.add(area, BorderLayout.CENTER); JPanel areaWrapper = new JPanel(new BorderLayout());
areaWrapper.add(area, BorderLayout.CENTER);
areaWrapper.setBackground(Color.white);
centerPane.add(areaWrapper, BorderLayout.CENTER);
tabCenterPane.add(centerPane, FORM_CARD, FORM_TAB); tabCenterPane.add(centerPane, FORM_CARD, FORM_TAB);
this.add(tabCenterPane, BorderLayout.CENTER); this.add(tabCenterPane, BorderLayout.CENTER);
@ -267,14 +272,14 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm {
} }
public void setSheetCovered(boolean isCovered) { public void setSheetCovered(boolean isCovered) {
return;
} }
/** /**
* 刷新容器 * 刷新容器
*/ */
public void refreshContainer() { public void refreshContainer() {
return;
} }
/** /**
@ -286,6 +291,7 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm {
@Override @Override
public void setScale(int resolution) { public void setScale(int resolution) {
return;
} }
@Override @Override
@ -461,15 +467,9 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm {
@Override @Override
public ShortCut[] shortcut4TemplateMenu() { public ShortCut[] shortcut4TemplateMenu() {
if (this.index == FORM_TAB) { if (this.index == FORM_TAB) {
return (ShortCut[]) ArrayUtils.addAll(new ShortCut[]{ return (ShortCut[]) ArrayUtils.addAll(new ShortCut[]{new TemplateParameterAction(this), new FormMobileAttrAction(this)}, new ShortCut[0]);
new TemplateParameterAction(this),
new FormMobileAttrAction(this)
}, new ShortCut[0]);
} else { } else {
return (ShortCut[]) ArrayUtils.addAll(new ShortCut[]{ return (ShortCut[]) ArrayUtils.addAll(new ShortCut[]{new TemplateParameterAction(this), new FormMobileAttrAction(this)}, this.elementCaseDesign.shortcut4TemplateMenu());
new TemplateParameterAction(this),
new FormMobileAttrAction(this)
}, this.elementCaseDesign.shortcut4TemplateMenu());
} }
} }
@ -677,16 +677,14 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm {
return; return;
} }
if (formDesign.isReportBlockEditing()) { if (formDesign.isReportBlockEditing() && elementCaseDesign != null) {
if (elementCaseDesign != null) { EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.FORM_REPORT);
EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.FORM_REPORT); EastRegionContainerPane.getInstance().removeParameterPane();
EastRegionContainerPane.getInstance().removeParameterPane(); EastRegionContainerPane.getInstance().replaceCellAttrPane(elementCaseDesign.getEastDownPane());
EastRegionContainerPane.getInstance().replaceCellAttrPane(elementCaseDesign.getEastDownPane()); EastRegionContainerPane.getInstance().replaceCellElementPane(elementCaseDesign.getEastUpPane());
EastRegionContainerPane.getInstance().replaceCellElementPane(elementCaseDesign.getEastUpPane()); EastRegionContainerPane.getInstance().replaceConditionAttrPane(elementCaseDesign.getConditionAttrPane());
EastRegionContainerPane.getInstance().replaceConditionAttrPane(elementCaseDesign.getConditionAttrPane()); EastRegionContainerPane.getInstance().replaceHyperlinkPane(elementCaseDesign.getHyperlinkPane());
EastRegionContainerPane.getInstance().replaceHyperlinkPane(elementCaseDesign.getHyperlinkPane()); return;
return;
}
} }
EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.FORM); EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.FORM);
@ -696,6 +694,10 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm {
EastRegionContainerPane.getInstance().addParameterPane(parameterPropertyPane); EastRegionContainerPane.getInstance().addParameterPane(parameterPropertyPane);
EastRegionContainerPane.getInstance().setParameterHeight(parameterPropertyPane.getPreferredSize().height); EastRegionContainerPane.getInstance().setParameterHeight(parameterPropertyPane.getPreferredSize().height);
refreshWidgetLibPane();
}
private void refreshWidgetLibPane() {
if (EastRegionContainerPane.getInstance().getWidgetLibPane() == null) { if (EastRegionContainerPane.getInstance().getWidgetLibPane() == null) {
new Thread() { new Thread() {
public void run() { public void run() {

Loading…
Cancel
Save