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) {
liteConditionPane = new DSColumnLiteConditionPane() {
protected boolean needDoWithCondition(Condition liteCondition) {
protected boolean isNeedDoWithCondition(Condition liteCondition) {
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() {
@Override
public void selectionChanged(SelectionEvent e) {
if (!isEditable()) {
if (!isEditable() && !BaseUtils.isAuthorityEditing()) {
return;
}
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;
public ReportComponentComposite reportComposite;
private ParameterDefinitePane parameterPane;
private int resolution;
private int resolution = ScreenResolution.getScreenResolution();
public JWorkBook() {
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 HUND = 100;
private static final int MIN = 10;
private static final int DIR = 15;
private JWorkBook parent;
private UIModeControlContainer parentContainer = null;
@ -71,7 +72,7 @@ public class ReportComponentComposite extends JComponent {
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));
}
}
};

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 = "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;
@ -89,7 +90,6 @@ public class AlphaFineDialog extends UIDialog {
//是否强制打开,因为面板是否关闭绑定了全局鼠标事件,这里需要处理一下
private boolean forceOpen;
public AlphaFineDialog(Frame parent, boolean forceOpen) {
super(parent);
this.forceOpen = forceOpen;
@ -161,12 +161,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());
}
});
}
/**
@ -174,7 +168,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);
@ -228,16 +222,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
@ -272,17 +261,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);
}
/**
@ -299,8 +288,8 @@ 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);
@ -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()) {
this.searchWorker.cancel(true);
this.searchWorker = null;
@ -325,9 +314,7 @@ public class AlphaFineDialog extends UIDialog {
this.searchWorker = new SwingWorker() {
@Override
protected Object doInBackground() throws Exception {
resumeLeftPane();
splitLabel.setIcon(new ImageIcon(getClass().getResource("/com/fr/design/mainframe/alphafine/images/bigloading.gif")));
rebuildList(searchTextField.getText().toLowerCase());
rebuildList(text);
return null;
}
@ -347,11 +334,9 @@ public class AlphaFineDialog extends UIDialog {
*/
private void resumeLeftPane() {
if (searchResultPane != null && defaultPane != null) {
rightSearchResultPane.removeAll();
searchResultPane.remove(defaultPane);
defaultPane = null;
searchResultPane.add(leftSearchResultPane, BorderLayout.WEST);
refreshContainer();
}
}
@ -394,25 +379,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();
@ -425,9 +411,11 @@ 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();
refreshContainer();
}
@ -437,23 +425,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();
@ -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);
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);
}
@ -639,11 +622,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);
@ -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")));
label.setBorder(BorderFactory.createEmptyBorder(120, 0, 0, 0));
rightSearchResultPane.add(label, BorderLayout.CENTER);
validate();
repaint();
refreshContainer();
}
/**
@ -667,18 +648,15 @@ public class AlphaFineDialog extends UIDialog {
}
/**
* 为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();
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);
} else {
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
public void checkValid() throws Exception {
//不处理
}
private void doNavigate() {
@ -778,7 +774,6 @@ public class AlphaFineDialog extends UIDialog {
if (!httpClient.isServerAlive()) {
FRLogger.getLogger().error("Failed to sent data to server!");
}
httpClient.setTimeout(5000);
}
@ -935,7 +930,7 @@ public class AlphaFineDialog extends UIDialog {
saveHistory(selectedValue);
} else if (e.getClickCount() == 1) {
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
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);
}
/**

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);

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

@ -75,10 +75,9 @@ public class ActionSearchManager implements AlphaFineSearchProcessor {
result.add(object);
}
}
if (result.size() == 0) {
if (result.isEmpty()) {
return lessModelList;
}
if (result.size() > 0 && result.size() < AlphaFineConstants.SHOW_SIZE + 1) {
} else if (result.size() < AlphaFineConstants.SHOW_SIZE + 1) {
lessModelList.add(0, new MoreModel(Inter.getLocText("FR-Designer_Set")));
lessModelList.addAll(result);
} 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()) {
return getNoConnectList();
}
httpClient.setTimeout(5000);
result = httpClient.getResponseText();
AlphaFineHelper.checkCancel();
try {
@ -76,10 +75,9 @@ public class DocumentSearchManager implements AlphaFineSearchProcessor {
searchResult.add(cellModel);
}
}
if (searchResult.size() == 0) {
if (searchResult.isEmpty()) {
return lessModelList;
}
if (searchResult.size() > 0 && searchResult.size() < AlphaFineConstants.SHOW_SIZE + 1) {
} else if (searchResult.size() < AlphaFineConstants.SHOW_SIZE + 1) {
lessModelList.add(0, new MoreModel(Inter.getLocText("FR-Designer_COMMUNITY_HELP")));
lessModelList.addAll(searchResult);
} else {
@ -90,7 +88,6 @@ public class DocumentSearchManager implements AlphaFineSearchProcessor {
}
} catch (JSONException e) {
FRLogger.getLogger().error("document search error: " + e.getMessage());
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;
}
if (result.size() > 0 && result.size() < AlphaFineConstants.SHOW_SIZE + 1) {
} else if (result.size() < AlphaFineConstants.SHOW_SIZE + 1) {
lessModelList.add(0, new MoreModel(Inter.getLocText("FR-Designer_Templates")));
lessModelList.addAll(result);
} 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()) {
return getNoConnectList();
}
httpClient.setTimeout(5000);
result = httpClient.getResponseText();
AlphaFineHelper.checkCancel();
JSONObject jsonObject = new JSONObject(result);
@ -109,11 +108,10 @@ public class PluginSearchManager implements AlphaFineSearchProcessor {
searchResult.add(cellModel);
}
}
if (searchResult.size() == 0) {
if (searchResult.isEmpty()) {
return this.lessModelList;
}
if (searchResult.size() > 0 && searchResult.size() < AlphaFineConstants.SHOW_SIZE + 1) {
lessModelList.add(0, new MoreModel(Inter.getLocText("FR-Designer_Templates")));
} else if (searchResult.size() < AlphaFineConstants.SHOW_SIZE + 1) {
lessModelList.add(0, new MoreModel(Inter.getLocText("FR-Designer-Plugin_Addon")));
lessModelList.addAll(searchResult);
} else {
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 HUND = 100;
private static final int MIN = 10;
private static final int DIR = 15;
private static final double MIN_TIME = 0.4;
public FormElementCaseDesigner elementCaseDesigner;
private BaseJForm jForm;
@ -61,7 +62,7 @@ public class FormReportComponentComposite extends JComponent implements TargetMo
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));
}
}
};

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.general.ComparatorUtils;
import com.fr.general.Inter;
import com.fr.general.SiteCenter;
import com.fr.stable.OperatingSystem;
import javax.swing.*;
@ -28,12 +29,13 @@ import java.util.Locale;
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 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 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() {
if (VT4FR.isLicAvailable(FRCoreContext.getBytes()) && VT4FR.ALPHA_FINE.support()) {
return isEnabled;
}
return false;
return 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.data.DataConstants;
import com.fr.data.condition.*;
import com.fr.data.core.Compare;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.formula.FormulaFactory;
@ -67,6 +66,9 @@ public abstract class LiteConditionPane<T extends Condition> extends BasicBeanPa
private UIButton moveDownButton;
private UIButton bracketButton;
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() {
@ -76,7 +78,7 @@ public abstract class LiteConditionPane<T extends Condition> extends BasicBeanPa
String text = formulaTextArea.getText();
if (text == null || text.length() <= 0) {
formula = new Formula("");
formula = new Formula(StringUtils.EMPTY);
} else {
formula = new Formula(text);
}
@ -89,7 +91,7 @@ public abstract class LiteConditionPane<T extends Condition> extends BasicBeanPa
public void doOk() {
Formula formula = formulaPane.update();
if (formula.getContent().length() <= 1) {// 如果没有填任何字符,则是空白文本
formulaTextArea.setText("");
formulaTextArea.setText(StringUtils.EMPTY);
} else {
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") + ":");
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);
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(formulaRadioButton, FlowLayout.CENTER));
commonRadioButton.addActionListener(radioActionListener);
@ -549,14 +551,14 @@ public abstract class LiteConditionPane<T extends Condition> extends BasicBeanPa
radioPane.add(andRadioButton);
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.setMnemonic('A');
addControlPane.add(addButton);
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.setMnemonic('M');
@ -844,7 +846,7 @@ public abstract class LiteConditionPane<T extends Condition> extends BasicBeanPa
*/
@Override
public void populateBean(Condition liteCondition) {
if(liteCondition == null){
if (liteCondition == null){
return;
}
// peter: 先删除所有的节点
@ -854,7 +856,7 @@ public abstract class LiteConditionPane<T extends Condition> extends BasicBeanPa
rootTreeNode.removeAllChildren();
// 清空编辑框
defaultConditionPane.populateBean((T)new ObjectCondition(new Compare(Compare.EQUALS, StringUtils.EMPTY)));
clearDefaultConditionPane();
formulaTextArea.setText(StringUtils.EMPTY);
// peter:需要构建成ListCondition,加入到里面.
@ -870,7 +872,7 @@ public abstract class LiteConditionPane<T extends Condition> extends BasicBeanPa
for (int i = 0; i < joinConditionCount; i++) {
addLiteConditionToListCondition(rootTreeNode, listCondition.getJoinCondition(i));
}
} else if (needDoWithCondition(liteCondition)) {
} else if (isNeedDoWithCondition(liteCondition)) {
// peter:直接添加
ExpandMutableTreeNode newTreeNode = new ExpandMutableTreeNode(new JoinCondition(DataConstants.AND, liteCondition));
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;
}
@ -931,12 +937,10 @@ public abstract class LiteConditionPane<T extends Condition> extends BasicBeanPa
// peter: 如果只有一个孩子节点, 返回空的 ListCondition
if (childCount == 0) {
return new ListCondition();
} // peter: 如果roottreeNode只有一个孩子节点.
else if (childCount == 1) {
} else if (childCount == 1) { // peter: 如果roottreeNode只有一个孩子节点.
JoinCondition joinCondition = (JoinCondition) ((ExpandMutableTreeNode) rootTreeNode.getChildAt(0)).getUserObject();
return joinCondition.getCondition();
} // peter: 有好多的孩子节点.
else {
} else { // peter: 有好多的孩子节点.
// peter:深度遍历所有的孩子节点
Enumeration depthEnumeration = rootTreeNode.depthFirstEnumeration();
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.ValueEditorPaneFactory;
import com.fr.general.Inter;
import com.fr.stable.StringUtils;
public class ObjectLiteConditionPane extends LiteConditionPane<ObjectCondition> {
@ -33,6 +34,11 @@ public class ObjectLiteConditionPane extends LiteConditionPane<ObjectCondition>
return VariableResolver.DEFAULT;
}
@Override
protected void clearDefaultConditionPane() {
defaultConditionPane.populateBean(new ObjectCondition(new Compare(Compare.EQUALS, StringUtils.EMPTY)));
}
private class ObjectConditionPane extends BasicBeanPane<ObjectCondition> {
private UIComboBox conditionOPComboBox;
@ -68,7 +74,7 @@ public class ObjectLiteConditionPane extends LiteConditionPane<ObjectCondition>
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 } };
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;
import com.fr.base.FRContext;
import com.fr.design.RestartHelper;
import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.UIDialog;
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.http.HttpClient;
import com.fr.json.JSONObject;
import com.fr.plugin.PluginStoreConstants;
import com.fr.plugin.PluginVerifyException;
import com.fr.stable.StableUtils;
@ -55,8 +55,8 @@ public class WebViewDlgHelper {
String indexPath = "index.html";
String mainIndexPath = StableUtils.pathJoin(installHome, indexPath);
checkAndCopyMainFile(mainIndexPath, mainJsPath);
updateShopScripts(SHOP_SCRIPTS);
showPluginDlg(mainIndexPath);
updateShopScripts(SHOP_SCRIPTS);
}
} else {
BasicPane traditionalStorePane = new BasicPane() {
@ -195,6 +195,7 @@ public class WebViewDlgHelper {
IOUtils.unzip(new File(StableUtils.pathJoin(PluginConstants.DOWNLOAD_PATH, PluginConstants.TEMP_FILE)), installHome);
copyMainFile(StableUtils.pathJoin(installHome, "index.html"), StableUtils.pathJoin(installHome, relativePath));
// 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);
}
} catch (InterruptedException | ExecutionException e) {
@ -209,7 +210,7 @@ public class WebViewDlgHelper {
new SwingWorker<Void, Void>() {
@Override
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();
if (httpClient.getResponseCode() == HttpURLConnection.HTTP_OK) {
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 {
private static final long serialVersionUID = 1L;
private static final int INCREAMENT = 30;
public UIScrollPane(Component c) {
super(c, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
this.setHorizontalScrollBar(createHorizontalScrollBar());
this.getVerticalScrollBar().setUnitIncrement(30);
this.getVerticalScrollBar().setBlockIncrement(30);
this.getVerticalScrollBar().setUnitIncrement(INCREAMENT);
this.getVerticalScrollBar().setBlockIncrement(INCREAMENT);
this.getHorizontalScrollBar().setOpaque(true);
this.getHorizontalScrollBar().setBackground(Color.WHITE);
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);
sbr.setBackground(UIConstants.NORMAL_BACKGROUND);
return sbr;
@ -39,7 +40,7 @@ public class UIScrollPane extends JScrollPane {
/**
* 生成垂直滚动条
*/
public JScrollBar createVerticalScrollBar() {
public UIScrollBar createVerticalScrollBar() {
UIScrollBar sbr = new UIScrollBar(JScrollBar.VERTICAL);
sbr.setBackground(UIConstants.NORMAL_BACKGROUND);
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
FormulaD-Invalid_Formula=Invalid Formula
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
Email-Can_Preview_Report_Content=Preview Report Content in the Body
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
FormulaD-Invalid_Formula=\u7121\u52B9\u306A\u516C\u5F0F
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)
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

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
FormulaD-Invalid_Formula=\uC62C\uBC14\uB974\uC9C0\uC54A\uC740\uC218\uC2DD
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)
Email-Can_Preview_Report_Content=\uBCF8\uBB38\uBBF8\uB9AC\uBCF4\uAE30\uBB38\uC11C\uB0B4\uC6A9
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
FormulaD-Invalid_Formula=\u975E\u6CD5\u7684\u516C\u5F0F
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)
Email-Can_Preview_Report_Content=\u6B63\u6587\u9884\u89C8\u62A5\u8868\u5185\u5BB9
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
FormulaD-Invalid_Formula=\u975E\u6CD5\u7684\u516C\u5F0F
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)
Email-Can_Preview_Report_Content=\u6B63\u6587\u9810\u89BD\u5831\u8868\u5167\u5BB9
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(SeparatorDef.DEFAULT);
if (VT4FR.isLicAvailable(FRCoreContext.getBytes()) && VT4FR.ALPHA_FINE.support()) {
shortCuts.add(new AlphaFineAction());
shortCuts.add(SeparatorDef.DEFAULT);
}
shortCuts.add(new AlphaFineAction());
shortCuts.add(SeparatorDef.DEFAULT);
shortCuts.add(new AboutAction());
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.Style;
import com.fr.base.Utils;
import com.fr.design.file.HistoryTemplateListPane;
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++) {
g.setColor(BaseRuler.UNIT_SIGN_COLOR);
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);
BaseUtils.drawStringStyleInRotation(gg, BaseRuler.NUMBER_100, BaseRuler.NUMBER_14, text, Style.getInstance().deriveHorizontalAlignment(
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.Style;
import com.fr.base.Utils;
import com.fr.design.file.HistoryTemplateListPane;
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++) {
g.setColor(BaseRuler.UNIT_SIGN_COLOR);
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);
String text = Utils.convertNumberStringToString(i / showText);
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(
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.DialogActionAdapter;
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.iscrollbar.UIScrollBar;
import com.fr.design.gui.itextarea.DescriptionTextArea;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.FRGUIPaneFactory;
@ -26,6 +28,7 @@ import javax.swing.*;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.filechooser.FileNameExtensionFilter;
import javax.swing.plaf.basic.BasicButtonUI;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
@ -44,14 +47,14 @@ public class CustomIconPane extends BasicPane {
private ListMap iconButtonMap = null;
private JPanel iconPane = null;
private ButtonGroup bg;
private JScrollPane jsPane;
private UIScrollPane jsPane;
// 老一次次去拿真麻烦
private IconManager iconManager = null;
private int width = 180;
private int horizontalCount = 6;
private int heightPer = 29;
private int gap = 10;
private static final int THE_WIDTH = 180;
private static final int HORIZONTAL_COUNT = 6;
private static final int HEIGHT_PER = 29;
private static final int GAP = 10;
public CustomIconPane() {
this.initComponents();
@ -69,7 +72,7 @@ public class CustomIconPane extends BasicPane {
// 开始加图标选择按钮
initIcons();
jsPane = new JScrollPane(iconPane);
jsPane = new UIScrollPane(iconPane);
refreshIconPane(false);
jsPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
@ -131,14 +134,11 @@ public class CustomIconPane extends BasicPane {
if (iconManager.addIcon(icon, false)) {
IconButton iconButton = null;//初始化
addIcon(icon,iconButton);
addIcon(icon, iconButton);
}else {
// add failed
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(),
Inter.getLocText("FR-Designer_Custom_Icon_Message2"),
Inter.getLocText("FR-Designer_Tooltips"),
JOptionPane.WARNING_MESSAGE);
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Inter.getLocText("FR-Designer_Custom_Icon_Message2"), Inter.getLocText("FR-Designer_Tooltips"), JOptionPane.WARNING_MESSAGE);
}
}
}).setVisible(true);
@ -189,6 +189,7 @@ public class CustomIconPane extends BasicPane {
try {
oldIcon= iconManager.getIcon(selectedIconName);
} catch (CloneNotSupportedException e1) {
// do nothing
}
if (oldIcon == null) {
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(),
@ -209,16 +210,13 @@ public class CustomIconPane extends BasicPane {
iconPane.remove(iconButton);
bg.remove(iconButton);
addIcon(icon,iconButton);
addIcon(icon, iconButton);
} else {
// 失败了再弄回去
iconManager.addIcon(oldIcon, true);
// edit failed
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(),
Inter.getLocText("FR-Designer_Custom_Icon_Message2"),
Inter.getLocText("FR-Designer_Tooltips"),
JOptionPane.WARNING_MESSAGE);
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), 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) {
iconPane.setPreferredSize(new Dimension(width, (iconButtonMap.size() / horizontalCount + 1) * heightPer + gap));
JScrollBar jsBar = jsPane.getVerticalScrollBar();
iconPane.setPreferredSize(new Dimension(THE_WIDTH, (iconButtonMap.size() / HORIZONTAL_COUNT + 1) * HEIGHT_PER + GAP));
UIScrollBar jsBar = jsPane.createVerticalScrollBar();
try {
if (down) {
// 将滚动条滚到最后
@ -282,29 +280,41 @@ public class CustomIconPane extends BasicPane {
jsBar.setValue(0);
}
} catch (RuntimeException re) {
return;
}
}
private class IconButton extends JToggleButton implements ActionListener{
private String iconName;
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) {
this.iconName = name;
this.addActionListener(this);
this.setCursor(new Cursor(Cursor.HAND_CURSOR));
this.setBorder(null);
this.iconImage = WidgetManager.getProviderInstance().getIconManager().getIconImage(name);
this.setToolTipText(iconName);
}
@Override
public void updateUI() {
setUI(new BasicButtonUI(){
public void paint(Graphics g, JComponent c) {
super.paint(g, c);
}
});
}
@Override
public void paintComponent(Graphics g) {
super.paintComponent(g);
Graphics2D g2d = (Graphics2D) g;
// carl:这里缩放显示 16 × 16
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)) {
g2d.setPaint(Color.RED);
@ -317,7 +327,7 @@ public class CustomIconPane extends BasicPane {
@Override
public Dimension getPreferredSize() {
return new Dimension(24, 24);
return new Dimension(ICON_BUTTON_SIZE, ICON_BUTTON_SIZE);
}
public void actionPerformed(ActionEvent evt) {
@ -348,75 +358,80 @@ public class CustomIconPane extends BasicPane {
private String oldName = null;
protected EditIconDialog() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
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);
init();
}
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));
}
}
private void init() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
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 Dimension(80, 25));
browseButton.setToolTipText(Inter.getLocText("FR-Designer_Click_this_button"));
nameTextField = new UITextField(20);
browseButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
onBrowseButtonClicked();
}
});
nameTextField = new UITextField(20);
// 焦点丢失时看看名称是否已经存在
nameTextField.addFocusListener(new FocusListener() {
public void focusGained(FocusEvent e) {
}
public void focusLost(FocusEvent e) {
if (oldName != null && ComparatorUtils.equals(oldName, nameTextField.getText())) {
return;
}
if (WidgetManager.getProviderInstance().getIconManager().contains(nameTextField.getText())) {
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(),
Inter.getLocText("FR-Designer_Custom_Icon_Message3"),
Inter.getLocText("FR-Designer_Tooltips"),
JOptionPane.WARNING_MESSAGE);
}
}
});
JPanel imagePane = new JPanel();
imagePane.setLayout(new FlowLayout(FlowLayout.LEFT, 30, 0));
showImageLabel = new UILabel();
showImageLabel.setPreferredSize(new Dimension(20,20));
imagePane.add(showImageLabel);
imagePane.add(browseButton);
Component[][] components = {
{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);
}
@Override
// 焦点丢失时看看名称是否已经存在
nameTextField.addFocusListener(new FocusListener() {
public void focusGained(FocusEvent e) {
// do nothing
}
public void focusLost(FocusEvent e) {
if (oldName != null && ComparatorUtils.equals(oldName, nameTextField.getText())) {
return;
}
if (WidgetManager.getProviderInstance().getIconManager().contains(nameTextField.getText())) {
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(),
Inter.getLocText("FR-Designer_Custom_Icon_Message3"),
Inter.getLocText("FR-Designer_Tooltips"),
JOptionPane.WARNING_MESSAGE);
}
}
});
JPanel imagePane = new JPanel();
imagePane.setLayout(new FlowLayout(FlowLayout.LEFT, 30, 0));
showImageLabel = new UILabel();
showImageLabel.setPreferredSize(new Dimension(20,20));
imagePane.add(showImageLabel);
imagePane.add(browseButton);
Component[][] components = {{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);
}
private void onBrowseButtonClicked() {
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())) {
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() {
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 SHOWVALMAX = 400;
private static final int SHOWVALMIN = 10;
private static final int RESIZE_PANE_GAP = 8;
private FormDesigner designer;
private int horizontalValue = 0;
private int verticalValue = 0;
@ -86,8 +87,6 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
}
this.setFocusTraversalKeysEnabled(false);
this.designer.addMouseWheelListener(showValSpinnerMouseWheelListener);
this.setOpaque(true);
this.setBackground(Color.WHITE);
}
MouseWheelListener showValSpinnerMouseWheelListener = new MouseWheelListener() {
@ -121,11 +120,7 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
slidePane = JFormSliderPane.getInstance();
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, 8);
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);
this.add(FormRulerLayout.BOTTOM, resizePane);
setWidgetsConfig();
// 先初始话滑块及对应事件,然后获取分辨率调整容器的显示大小
@ -441,17 +436,20 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
int id = evt.getID();
switch (id) {
case MouseEvent.MOUSE_WHEEL: {
int rotations = evt.getWheelRotation();
int value = this.verScrollBar.getValue() + rotations * ROTATIONS;
value = Math.min(value, verticalMax);
value = Math.max(0, value);
doLayout(); //加dolayout是因为每次滚动都要重置 Max的大小
this.verScrollBar.setValue(value);
onMouseWheelScroll(evt);
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
* getFormEditor.
@ -745,9 +743,12 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
}
private class FormRulerLayout extends RulerLayout {
private int DESIGNERWIDTH = 960;
private int DESIGNERHEIGHT = 540;
private int TOPGAP = 8;
private static final int DESIGNER_WIDTH = 960;
private static final int DESIGNER_HEIGHT = 540;
private static final int TOPGAP = 8;
private int DESIGNERWIDTH = DESIGNER_WIDTH;
private int DESIGNERHEIGHT = DESIGNER_HEIGHT;
public FormRulerLayout() {
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
public void refreshEastPropertiesPane() {
// 暂时用不到,遇到的时候再加刷新右侧tab面板的代码
return;
}
@Override
@ -126,7 +128,7 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm {
@Override
public void setJTemplateResolution(int resolution) {
return;
}
@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));
WidgetToolBarPane.getInstance(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);
this.add(tabCenterPane, BorderLayout.CENTER);
@ -267,14 +272,14 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm {
}
public void setSheetCovered(boolean isCovered) {
return;
}
/**
* 刷新容器
*/
public void refreshContainer() {
return;
}
/**
@ -286,6 +291,7 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm {
@Override
public void setScale(int resolution) {
return;
}
@Override
@ -461,15 +467,9 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm {
@Override
public ShortCut[] shortcut4TemplateMenu() {
if (this.index == FORM_TAB) {
return (ShortCut[]) ArrayUtils.addAll(new ShortCut[]{
new TemplateParameterAction(this),
new FormMobileAttrAction(this)
}, new ShortCut[0]);
return (ShortCut[]) ArrayUtils.addAll(new ShortCut[]{new TemplateParameterAction(this), new FormMobileAttrAction(this)}, new ShortCut[0]);
} else {
return (ShortCut[]) ArrayUtils.addAll(new ShortCut[]{
new TemplateParameterAction(this),
new FormMobileAttrAction(this)
}, this.elementCaseDesign.shortcut4TemplateMenu());
return (ShortCut[]) ArrayUtils.addAll(new ShortCut[]{new TemplateParameterAction(this), new FormMobileAttrAction(this)}, this.elementCaseDesign.shortcut4TemplateMenu());
}
}
@ -677,16 +677,14 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm {
return;
}
if (formDesign.isReportBlockEditing()) {
if (elementCaseDesign != null) {
EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.FORM_REPORT);
EastRegionContainerPane.getInstance().removeParameterPane();
EastRegionContainerPane.getInstance().replaceCellAttrPane(elementCaseDesign.getEastDownPane());
EastRegionContainerPane.getInstance().replaceCellElementPane(elementCaseDesign.getEastUpPane());
EastRegionContainerPane.getInstance().replaceConditionAttrPane(elementCaseDesign.getConditionAttrPane());
EastRegionContainerPane.getInstance().replaceHyperlinkPane(elementCaseDesign.getHyperlinkPane());
return;
}
if (formDesign.isReportBlockEditing() && elementCaseDesign != null) {
EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.FORM_REPORT);
EastRegionContainerPane.getInstance().removeParameterPane();
EastRegionContainerPane.getInstance().replaceCellAttrPane(elementCaseDesign.getEastDownPane());
EastRegionContainerPane.getInstance().replaceCellElementPane(elementCaseDesign.getEastUpPane());
EastRegionContainerPane.getInstance().replaceConditionAttrPane(elementCaseDesign.getConditionAttrPane());
EastRegionContainerPane.getInstance().replaceHyperlinkPane(elementCaseDesign.getHyperlinkPane());
return;
}
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().setParameterHeight(parameterPropertyPane.getPreferredSize().height);
refreshWidgetLibPane();
}
private void refreshWidgetLibPane() {
if (EastRegionContainerPane.getInstance().getWidgetLibPane() == null) {
new Thread() {
public void run() {

Loading…
Cancel
Save