Browse Source

Merge pull request #5928 in DESIGN/design from final/10.0 to persist/10.0

* commit 'fe51aad700c5ce34caa0717146ada2f90c1aed75': (43 commits)
  REPORT-59719 fix加个判断
  REPORT-59719 下拉框效果还有点问题 fix
  REPORT-59719 下拉框效果还有点问题
  REPORT-59719 【10.0】点击数据源的刷新按钮,数据列表会变空白
  REPORT-55377 更新Tomcat版本到8.5.69
  CHART-20642 图表预定义配色避免重名和空字符串名
  REPORT-59189 导出-导出事件-导出模板选cptx会出问题
  REPORT-57551 设计器显示,自适应布局下body背景设置以后,画布中没有实时显示背景
  REPORT-57551 设计器显示,自适应布局下body背景设置以后,画布中没有实时显示背景
  REPORT-57551 设计器显示,自适应布局下body背景设置以后,画布中没有实时显示背景
  REPORT-58301 【决策报表】布局切换以后,body背景样式不保留
  REPORT-58252 报表块单元格行列标识去掉后的弥补方案
  REPORT-58626 新自适应-报表块-旧模板设为横向自适应,切换成新模板后图片背景不见了
  REPORT-58252 报表块单元格行列标识去掉后的弥补方案
  CHART-20568 [产品验收]设计器预览页面图表组件鬼畜 & CHART-20627 图表块组件,鼠标双击,会出现图形重影
  REPORT-57898 【权限编辑】进入权限编辑时打开frm/大屏模板/版本管理,再回到原模板,无法退出权限编辑状态
  REPORT-57898 【权限编辑】进入权限编辑时打开frm/大屏模板/版本管理,再回到原模板,无法退出权限编辑状态
  REPORT-57898 【权限编辑】进入权限编辑时打开frm/大屏模板/版本管理,再回到原模板,无法退出权限编辑状态
  REPORT-58991 设计器内-模板画布可滚动-点击组件编辑-不在视线内的组件,编辑锁定位置有问题
  REPORT-58207 系统原生文件选择器弹窗-mac插入图片弹窗时会出现文件选择器弹窗被遮盖的情况
  ...
persist/10.0 10.0.19.2021.09.18
superman 3 years ago
parent
commit
ec941e397b
  1. 2
      build.gradle
  2. 3
      designer-base/src/main/java/com/fr/design/DesignerEnvManager.java
  3. 7
      designer-base/src/main/java/com/fr/design/actions/help/TutorialAction.java
  4. 10
      designer-base/src/main/java/com/fr/design/base/mode/DesignModeContext.java
  5. 20
      designer-base/src/main/java/com/fr/design/base/mode/DesignerMode.java
  6. 48
      designer-base/src/main/java/com/fr/design/data/datapane/ChoosePane.java
  7. 5
      designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionComboBoxPanel.java
  8. 63
      designer-base/src/main/java/com/fr/design/data/datapane/connect/ItemEditableComboBoxPanel.java
  9. 7
      designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java
  10. 4
      designer-base/src/main/java/com/fr/design/gui/controlpane/JListControlPane.java
  11. 3
      designer-base/src/main/java/com/fr/design/gui/ifilechooser/JavaFxNativeFileChooser.java
  12. 23
      designer-base/src/main/java/com/fr/design/gui/ilist/JNameEdList.java
  13. 8
      designer-base/src/main/java/com/fr/design/gui/itextfield/EditTextField.java
  14. 4
      designer-base/src/main/java/com/fr/design/javascript/ExportJavaScriptPane.java
  15. 11
      designer-base/src/main/java/com/fr/design/login/AbstractDesignerSSO.java
  16. 13
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java
  17. 3
      designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java
  18. 1
      designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogMessageBar.java
  19. 33
      designer-base/src/main/java/com/fr/design/roleAuthority/RolesEditedSourceOP.java
  20. 13
      designer-base/src/main/java/com/fr/design/utils/DesignUtils.java
  21. 1
      designer-base/src/main/resources/com/fr/design/i18n/dimension_en.properties
  22. 1
      designer-base/src/main/resources/com/fr/design/i18n/dimension_ja_JP.properties
  23. 1
      designer-base/src/main/resources/com/fr/design/i18n/dimension_ko_KR.properties
  24. 1
      designer-base/src/main/resources/com/fr/design/i18n/dimension_zh.properties
  25. 1
      designer-base/src/main/resources/com/fr/design/i18n/dimension_zh_TW.properties
  26. 7
      designer-base/src/test/java/com/fr/design/utils/DesignUtilsTest.java
  27. 41
      designer-chart/src/main/java/com/fr/design/module/ChartPreStyleListPane.java
  28. 42
      designer-form/src/main/java/com/fr/design/designer/creator/XBorderStyleWidgetCreator.java
  29. 15
      designer-form/src/main/java/com/fr/design/designer/creator/XChartEditor.java
  30. 20
      designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java
  31. 17
      designer-form/src/main/java/com/fr/design/designer/creator/XElementCase.java
  32. 6
      designer-form/src/main/java/com/fr/design/designer/creator/XLayoutContainer.java
  33. 8
      designer-form/src/main/java/com/fr/design/designer/creator/XWAbsoluteBodyLayout.java
  34. 2
      designer-form/src/main/java/com/fr/design/designer/creator/XWAbsoluteLayout.java
  35. 2
      designer-form/src/main/java/com/fr/design/designer/creator/XWTitleLayout.java
  36. 10
      designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardLayout.java
  37. 2
      designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardMainBorderLayout.java
  38. 2
      designer-form/src/main/java/com/fr/design/mainframe/FormArea.java
  39. 8
      designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java
  40. 21
      designer-form/src/main/java/com/fr/design/mainframe/FormSelection.java
  41. 8
      designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRAbsoluteBodyLayoutDefinePane.java
  42. 14
      designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRFitLayoutDefinePane.java
  43. 21
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java
  44. 4
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/HotIssuesManager.java
  45. 5
      designer-realize/src/main/java/com/fr/design/mainframe/app/FormApp.java
  46. 3
      designer-realize/src/main/java/com/fr/design/mainframe/form/FormElementCaseDesigner.java
  47. 3
      designer-realize/src/main/java/com/fr/design/webattr/WebCssPane.java
  48. 5
      designer-realize/src/main/java/com/fr/design/webattr/WebJsPane.java
  49. 20
      designer-realize/src/main/java/com/fr/grid/AbstractGridHeaderMouseHandler.java
  50. 10
      designer-realize/src/main/java/com/fr/grid/Grid.java
  51. 104
      designer-realize/src/main/java/com/fr/grid/GridUI.java

2
build.gradle

@ -68,7 +68,7 @@ allprojects {
implementation 'org.swingexplorer:swexpl:2.0.1' implementation 'org.swingexplorer:swexpl:2.0.1'
implementation 'org.swingexplorer:swag:1.0' implementation 'org.swingexplorer:swag:1.0'
implementation 'net.java.dev.jna:jna:5.4.0' implementation 'net.java.dev.jna:jna:5.4.0'
implementation 'org.apache.tomcat:tomcat-catalina:8.5.57' implementation 'org.apache.tomcat:tomcat-catalina:8.5.69'
implementation 'io.socket:socket.io-client:0.7.0' implementation 'io.socket:socket.io-client:0.7.0'
implementation 'com.fr.third:fine-third:' + frVersion implementation 'com.fr.third:fine-third:' + frVersion
implementation 'com.fr.core:fine-core:' + frDevVersion implementation 'com.fr.core:fine-core:' + frDevVersion

3
designer-base/src/main/java/com/fr/design/DesignerEnvManager.java

@ -390,9 +390,6 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
} }
File envHome = new File(userHome + File.separator + "." + ProductConstants.APP_NAME + version); File envHome = new File(userHome + File.separator + "." + ProductConstants.APP_NAME + version);
if (!envHome.exists()) {
StableUtils.mkdirs(envHome);
}
return envHome.getAbsolutePath(); return envHome.getAbsolutePath();
} }

7
designer-base/src/main/java/com/fr/design/actions/help/TutorialAction.java

@ -1,5 +1,6 @@
package com.fr.design.actions.help; package com.fr.design.actions.help;
import com.fr.design.i18n.Toolkit;
import com.fr.design.login.AbstractDesignerSSO; import com.fr.design.login.AbstractDesignerSSO;
import com.fr.design.menu.MenuKeySet; import com.fr.design.menu.MenuKeySet;
import com.fr.general.CloudCenter; import com.fr.general.CloudCenter;
@ -27,7 +28,11 @@ public class TutorialAction extends AbstractDesignerSSO {
@Override @Override
public String getJumpUrl() { public String getJumpUrl() {
return CloudCenter.getInstance().acquireUrlByKind(createDocKey()); return CloudCenter.getInstance().acquireUrlByKind(createDocKey(), "http://help.finereport.com");
}
public String getOffLineWarnMessage() {
return Toolkit.i18nText("Fine-Design_Offline_Helptutorial_Msg");
} }
// 生成帮助文档 sitecenter key, help.zh_CN.10 // 生成帮助文档 sitecenter key, help.zh_CN.10

10
designer-base/src/main/java/com/fr/design/base/mode/DesignModeContext.java

@ -10,7 +10,15 @@ public class DesignModeContext {
private static DesignerMode mode = DesignerMode.NORMAL; private static DesignerMode mode = DesignerMode.NORMAL;
public static void switchTo(DesignerMode mode) { public static void switchTo(DesignerMode mode) {
DesignModeContext.mode = mode; changeMode(DesignModeContext.mode, mode);
}
private static void changeMode(DesignerMode oldMode, DesignerMode newMode) {
if (oldMode != newMode) {
DesignModeContext.mode = newMode;
oldMode.closeMode();
newMode.openMode();
}
} }
public static DesignerMode getMode() { public static DesignerMode getMode() {

20
designer-base/src/main/java/com/fr/design/base/mode/DesignerMode.java

@ -1,9 +1,25 @@
package com.fr.design.base.mode; package com.fr.design.base.mode;
import com.fr.design.mainframe.DesignerContext;
public enum DesignerMode { public enum DesignerMode {
NORMAL, NORMAL,
BAN_COPY_AND_CUT, BAN_COPY_AND_CUT,
VCS, VCS,
AUTHORITY, AUTHORITY {
DUCHAMP @Override
public void closeMode() {
DesignerContext.getDesignerFrame().closeAuthorityMode();
}
},
DUCHAMP;
public void openMode() {
}
public void closeMode() {
}
} }

48
designer-base/src/main/java/com/fr/design/data/datapane/ChoosePane.java

@ -25,6 +25,7 @@ import com.fr.design.gui.icombobox.UIComboBoxEditor;
import com.fr.design.gui.icombobox.UIComboBoxRenderer; import com.fr.design.gui.icombobox.UIComboBoxRenderer;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode; import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
@ -39,7 +40,16 @@ import com.fr.stable.StringUtils;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import com.fr.workspace.server.connection.DBConnectAuth; import com.fr.workspace.server.connection.DBConnectAuth;
import javax.swing.*; import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.util.Collections;
import java.util.concurrent.CancellationException;
import javax.swing.JList;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTree;
import javax.swing.SwingWorker;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
import javax.swing.event.PopupMenuEvent; import javax.swing.event.PopupMenuEvent;
@ -50,7 +60,6 @@ import javax.swing.tree.DefaultTreeModel;
import javax.swing.tree.TreeCellRenderer; import javax.swing.tree.TreeCellRenderer;
import javax.swing.tree.TreeNode; import javax.swing.tree.TreeNode;
import javax.swing.tree.TreePath; import javax.swing.tree.TreePath;
import java.awt.*;
import java.awt.event.FocusAdapter; import java.awt.event.FocusAdapter;
import java.awt.event.FocusEvent; import java.awt.event.FocusEvent;
import java.awt.event.ItemEvent; import java.awt.event.ItemEvent;
@ -70,6 +79,9 @@ import java.util.concurrent.FutureTask;
* @since 2012-7-11下午4:49:39 * @since 2012-7-11下午4:49:39
*/ */
public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refreshable, Previewable, Prepare4DataSourceChange { public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refreshable, Previewable, Prepare4DataSourceChange {
private static final List<String> PENDING_CONTENT = new ArrayList<>(Collections.singletonList(Toolkit.i18nText("Fine-Design_Basic_Loading") + "..."));
private static final double COLUMN_SIZE = 24; private static final double COLUMN_SIZE = 24;
/** /**
@ -91,6 +103,8 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
private SwingWorker populateWorker; private SwingWorker populateWorker;
private SwingWorker<List<String>, Void> initWorker;
private PopupMenuListener popupMenuListener = new PopupMenuListener() { private PopupMenuListener popupMenuListener = new PopupMenuListener() {
@Override @Override
@ -213,10 +227,34 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
protected void initDsNameComboBox() { protected void initDsNameComboBox() {
if (initWorker != null && !initWorker.isDone()) {
initWorker.cancel(true);
}
dsNameComboBox.setRefreshingModel(true); dsNameComboBox.setRefreshingModel(true);
FilterableComboBoxModel dsNameComboBoxModel = new FilterableComboBoxModel(getHasAuthConnections()); dsNameComboBox.setModel(new FilterableComboBoxModel(PENDING_CONTENT));
dsNameComboBox.setModel(dsNameComboBoxModel); initWorker = new SwingWorker<List<String>, Void>() {
dsNameComboBox.setRefreshingModel(false);
@Override
protected List<String> doInBackground() throws Exception {
return getHasAuthConnections();
}
@Override
protected void done() {
try {
FilterableComboBoxModel dsNameComboBoxModel = new FilterableComboBoxModel(get());
String selected = dsNameComboBox.getSelectedItem();
dsNameComboBox.setModel(dsNameComboBoxModel);
dsNameComboBox.setSelectedItem(selected);
dsNameComboBox.setRefreshingModel(false);
} catch (Exception e) {
if (!(e instanceof CancellationException)) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
}
};
initWorker.execute();
} }
protected void initComponentsLayout(PreviewLabel previewLabel, int labelSize) { protected void initComponentsLayout(PreviewLabel previewLabel, int labelSize) {

5
designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionComboBoxPanel.java

@ -87,12 +87,13 @@ public class ConnectionComboBoxPanel extends ItemEditableComboBoxPanel {
* 刷新ComboBox.items * 刷新ComboBox.items
*/ */
protected Iterator<String> items() { protected Iterator<String> items() {
nameList = new ArrayList<String>();
ConnectionConfig mgr = ConnectionConfig.getInstance(); ConnectionConfig mgr = ConnectionConfig.getInstance();
Iterator<String> nameIt = mgr.getConnections().keySet().iterator(); Iterator<String> nameIt = mgr.getConnections().keySet().iterator();
Collection<String> noAuthConnections = WorkContext.getCurrent().get(DBConnectAuth.class).getNoAuthConnections(); Collection<String> noAuthConnections = WorkContext.getCurrent().get(DBConnectAuth.class).getNoAuthConnections();
nameList = new ArrayList<>();
if (noAuthConnections == null) { if (noAuthConnections == null) {
return nameList.iterator(); return nameList.iterator();
} }

63
designer-base/src/main/java/com/fr/design/data/datapane/connect/ItemEditableComboBoxPanel.java

@ -3,12 +3,19 @@ package com.fr.design.data.datapane.connect;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import javax.swing.*; import com.fr.log.FineLoggerFactory;
import java.awt.*; import java.awt.BorderLayout;
import java.awt.Dimension;
import java.util.Iterator;
import java.util.concurrent.CancellationException;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JPanel;
import javax.swing.SwingWorker;
public abstract class ItemEditableComboBoxPanel extends JPanel { public abstract class ItemEditableComboBoxPanel extends JPanel {
/** /**
@ -16,6 +23,8 @@ public abstract class ItemEditableComboBoxPanel extends JPanel {
*/ */
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private static final String PENDING = Toolkit.i18nText("Fine-Design_Basic_Loading") + "...";
protected static final Object EMPTY = new Object() { protected static final Object EMPTY = new Object() {
public String toString() { public String toString() {
return ""; return "";
@ -26,6 +35,8 @@ public abstract class ItemEditableComboBoxPanel extends JPanel {
protected UIButton editButton; protected UIButton editButton;
protected UIButton refreshButton; protected UIButton refreshButton;
private SwingWorker<Iterator<String>, Void> refreshWorker;
public ItemEditableComboBoxPanel() { public ItemEditableComboBoxPanel() {
super(); super();
@ -75,6 +86,11 @@ public abstract class ItemEditableComboBoxPanel extends JPanel {
* 刷新itemComboBox的内容 * 刷新itemComboBox的内容
*/ */
protected void refreshItems() { protected void refreshItems() {
if (refreshWorker != null && !refreshWorker.isDone()) {
refreshWorker.cancel(true);
}
// 记录原来选中的Item,重新加载后需要再次选中 // 记录原来选中的Item,重新加载后需要再次选中
Object lastSelectedItem = itemComboBox.getSelectedItem(); Object lastSelectedItem = itemComboBox.getSelectedItem();
@ -83,18 +99,43 @@ public abstract class ItemEditableComboBoxPanel extends JPanel {
// 先加EMPTY,再加items // 先加EMPTY,再加items
model.addElement(EMPTY); model.addElement(EMPTY);
model.addElement(PENDING);
java.util.Iterator<String> itemIt = items(); // 存在两种场景之前只考虑了填充场景 有populate会填充下 把这边的填充逻辑删了 所以没有问题
while(itemIt.hasNext()) { // 如果是纯通过刷新按钮 没有populate 需要手动设置下上次选中的内容
model.addElement(itemIt.next()); if (lastSelectedItem != null) {
model.setSelectedItem(lastSelectedItem);
} }
// 再次选中之前选中的Item refreshWorker = new SwingWorker<Iterator<String>, Void>() {
int idx = model.getIndexOf(lastSelectedItem); @Override
if(idx < 0) { protected Iterator<String> doInBackground() throws Exception {
idx = 0; return items();
} }
itemComboBox.setSelectedIndex(idx);
@Override
protected void done() {
try {
Iterator<String> itemIt = get();
model.removeElement(PENDING);
while(itemIt.hasNext()) {
model.addElement(itemIt.next());
}
// 如果加载成功 但是下拉框是可见的 下拉框高度是会固定为原始高度 不会因为填充了更多下拉项而变化
// 需要重新设置下拉框高度 但值一样时相关事件不会生效 所以先加再减下
if (itemComboBox.isPopupVisible()) {
itemComboBox.setMaximumRowCount(itemComboBox.getMaximumRowCount() + 1);
itemComboBox.setMaximumRowCount(itemComboBox.getMaximumRowCount() - 1);
}
} catch (Exception e) {
if (!(e instanceof CancellationException)) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
}
};
refreshWorker.execute();
} }
/* /*

7
designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java

@ -4,6 +4,7 @@ import com.fr.base.chart.chartdata.CallbackEvent;
import com.fr.base.io.BaseBook; import com.fr.base.io.BaseBook;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.base.mode.DesignModeContext; import com.fr.design.base.mode.DesignModeContext;
import com.fr.design.base.mode.DesignerMode;
import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.DesignTableDataManager;
import com.fr.design.file.filter.ClassFilter; import com.fr.design.file.filter.ClassFilter;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
@ -69,7 +70,7 @@ public class HistoryTemplateListCache implements CallbackEvent {
DesignTableDataManager.closeTemplate(selected); DesignTableDataManager.closeTemplate(selected);
//直接关闭模板的时候(当且仅当设计器tab上只剩一个模板)退出权限编辑 //直接关闭模板的时候(当且仅当设计器tab上只剩一个模板)退出权限编辑
if (DesignModeContext.isAuthorityEditing() && historyList.size() <= 1) { if (DesignModeContext.isAuthorityEditing() && historyList.size() <= 1) {
DesignerContext.getDesignerFrame().closeAuthorityEditing(); DesignModeContext.switchTo(DesignerMode.NORMAL);
} }
if (contains(selected) == -1) { if (contains(selected) == -1) {
return; return;
@ -430,13 +431,13 @@ public class HistoryTemplateListCache implements CallbackEvent {
*/ */
@Deprecated @Deprecated
public void reloadCurrentTemplate() { public void reloadCurrentTemplate() {
reloadAllEditingTemplate(); reloadAllEditingTemplate();
} }
/** /**
* 重绘当前模板 * 重绘当前模板
*/ */
public void repaintCurrentEditingTemplate(){ public void repaintCurrentEditingTemplate() {
UIUtil.invokeLaterIfNeeded(new Runnable() { UIUtil.invokeLaterIfNeeded(new Runnable() {
@Override @Override
public void run() { public void run() {

4
designer-base/src/main/java/com/fr/design/gui/controlpane/JListControlPane.java

@ -23,12 +23,12 @@ import javax.swing.ListSelectionModel;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener; import javax.swing.event.ListSelectionListener;
import java.util.Collection;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Component; import java.awt.Component;
import java.awt.event.MouseAdapter; import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.awt.event.MouseListener; import java.awt.event.MouseListener;
import java.util.Collection;
public abstract class JListControlPane extends JControlPane implements ListControlPaneProvider { public abstract class JListControlPane extends JControlPane implements ListControlPaneProvider {
private static final String LIST_NAME = "JControl_List"; private static final String LIST_NAME = "JControl_List";
@ -335,7 +335,7 @@ public abstract class JListControlPane extends JControlPane implements ListContr
getHelper().checkButtonEnabled(); getHelper().checkButtonEnabled();
} }
private class NameableListCellRenderer extends protected class NameableListCellRenderer extends
DefaultListCellRenderer { DefaultListCellRenderer {
@Override @Override
public Component getListCellRendererComponent(JList list, Object value, public Component getListCellRendererComponent(JList list, Object value,

3
designer-base/src/main/java/com/fr/design/gui/ifilechooser/JavaFxNativeFileChooser.java

@ -67,6 +67,9 @@ public class JavaFxNativeFileChooser implements FileChooserProvider {
fileChooserParent = DesignerContext.getDesignerFrame(); fileChooserParent = DesignerContext.getDesignerFrame();
} }
Stage stage = showCoverStage(fileChooserParent); Stage stage = showCoverStage(fileChooserParent);
if (stage != null) {
stage.setAlwaysOnTop(true);
}
try { try {
if (fileSelectionMode == FileSelectionMode.FILE || fileSelectionMode == FileSelectionMode.MULTIPLE_FILE) { if (fileSelectionMode == FileSelectionMode.FILE || fileSelectionMode == FileSelectionMode.MULTIPLE_FILE) {
FileChooser fileChooser = new FileChooser(); FileChooser fileChooser = new FileChooser();

23
designer-base/src/main/java/com/fr/design/gui/ilist/JNameEdList.java

@ -1,25 +1,22 @@
package com.fr.design.gui.ilist; package com.fr.design.gui.ilist;
import com.fr.design.gui.NameInspector; import com.fr.design.gui.NameInspector;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.general.GeneralUtils; import com.fr.general.GeneralUtils;
import com.fr.general.NameObject; import com.fr.general.NameObject;
import com.fr.base.Utils;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.stable.Nameable; import com.fr.stable.Nameable;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.core.PropertyChangeAdapter; import com.fr.stable.core.PropertyChangeAdapter;
import javax.swing.*; import javax.swing.ListModel;
import javax.swing.event.CellEditorListener; import javax.swing.event.CellEditorListener;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
import java.awt.*;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Vector; import java.util.Vector;
import java.awt.Component;
import java.awt.Rectangle;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
public class JNameEdList extends UIList implements CellEditorListener { public class JNameEdList extends UIList implements CellEditorListener {
private static final int ICON_WIDTH = 20; private static final int ICON_WIDTH = 20;
@ -38,6 +35,8 @@ public class JNameEdList extends UIList implements CellEditorListener {
*/ */
private String oldName; private String oldName;
private boolean replaceEmptyName = true;
public JNameEdList(ListModel dataModel) { public JNameEdList(ListModel dataModel) {
super(dataModel); super(dataModel);
} }
@ -70,6 +69,10 @@ public class JNameEdList extends UIList implements CellEditorListener {
return this.editable; return this.editable;
} }
public void setReplaceEmptyName(boolean replaceEmptyName) {
this.replaceEmptyName = replaceEmptyName;
}
public void setNameShouldNumber(boolean isNameShouldNumber) { public void setNameShouldNumber(boolean isNameShouldNumber) {
this.isNameShouldNumber = isNameShouldNumber; this.isNameShouldNumber = isNameShouldNumber;
} }
@ -301,7 +304,7 @@ public class JNameEdList extends UIList implements CellEditorListener {
ListCellEditor editor = getCellEditor(); ListCellEditor editor = getCellEditor();
if (editor != null && editorComp != null) { if (editor != null && editorComp != null) {
Object value = editor.getCellEditorValue(); Object value = editor.getCellEditorValue();
String name = StringUtils.isBlank(value.toString()) ? oldName : value.toString(); String name = StringUtils.isBlank(value.toString()) && replaceEmptyName ? oldName : value.toString();
setNameAt(name, editingIndex); setNameAt(name, editingIndex);
removeComp(); removeComp();
doAfterStopEditing(); doAfterStopEditing();

8
designer-base/src/main/java/com/fr/design/gui/itextfield/EditTextField.java

@ -13,6 +13,9 @@ import javax.swing.text.PlainDocument;
* Number Field. * Number Field.
*/ */
public class EditTextField extends UIGridTextField { public class EditTextField extends UIGridTextField {
private static final String I18NProperty = "i18n";
private int maxLength = 24; private int maxLength = 24;
public EditTextField() { public EditTextField() {
@ -39,7 +42,11 @@ public class EditTextField extends UIGridTextField {
} }
class TextDocument extends PlainDocument { class TextDocument extends PlainDocument {
private Object defaultI18NProperty;
public TextDocument() { public TextDocument() {
defaultI18NProperty = getProperty(I18NProperty);
} }
@Override @Override
@ -49,6 +56,7 @@ public class EditTextField extends UIGridTextField {
Toolkit.getDefaultToolkit().beep(); Toolkit.getDefaultToolkit().beep();
return; return;
} }
putProperty(I18NProperty, defaultI18NProperty);
super.insertString(offset, s, a); super.insertString(offset, s, a);
} }
} }

4
designer-base/src/main/java/com/fr/design/javascript/ExportJavaScriptPane.java

@ -2,6 +2,7 @@ package com.fr.design.javascript;
import com.fr.base.BaseFormula; import com.fr.base.BaseFormula;
import com.fr.base.Parameter; import com.fr.base.Parameter;
import com.fr.base.extension.FileExtension;
import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.DialogActionAdapter;
@ -417,6 +418,9 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript
if (path == null) { if (path == null) {
throw new Exception(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Function_The_Selected_File_Cannot_Be_Null")); throw new Exception(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Function_The_Selected_File_Cannot_Be_Null"));
} }
if (path.endsWith(FileExtension.CPTX.getExtension())) {
throw new Exception(Toolkit.i18nText("Fine-Design_Basic_Function_Cptx_Unsupported"));
}
} }
/** /**

11
designer-base/src/main/java/com/fr/design/login/AbstractDesignerSSO.java

@ -6,6 +6,9 @@ import com.fr.design.actions.UpdateAction;
import com.fr.design.login.utils.DesignerLoginUtils; import com.fr.design.login.utils.DesignerLoginUtils;
import com.fr.design.os.impl.SupportOSImpl; import com.fr.design.os.impl.SupportOSImpl;
import com.fr.design.utils.BrowseUtils; import com.fr.design.utils.BrowseUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
@ -21,6 +24,10 @@ public abstract class AbstractDesignerSSO extends UpdateAction {
public void actionPerformed(ActionEvent event) { public void actionPerformed(ActionEvent event) {
String url = getJumpUrl(); String url = getJumpUrl();
if (!DesignerLoginUtils.isOnline()) { if (!DesignerLoginUtils.isOnline()) {
String message = getOffLineWarnMessage();
if (StringUtils.isNotEmpty(message)) {
FineLoggerFactory.getLogger().warn(message);
}
BrowseUtils.browser(url); BrowseUtils.browser(url);
return; return;
} }
@ -47,4 +54,8 @@ public abstract class AbstractDesignerSSO extends UpdateAction {
} }
public abstract String getJumpUrl(); public abstract String getJumpUrl();
public String getOffLineWarnMessage() {
return StringUtils.EMPTY;
}
} }

13
designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java

@ -9,6 +9,7 @@ import com.fr.design.DesignerEnvManager;
import com.fr.design.ExtraDesignClassManager; import com.fr.design.ExtraDesignClassManager;
import com.fr.design.actions.core.ActionFactory; import com.fr.design.actions.core.ActionFactory;
import com.fr.design.base.mode.DesignModeContext; import com.fr.design.base.mode.DesignModeContext;
import com.fr.design.base.mode.DesignerMode;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.DesignTableDataManager;
import com.fr.design.data.datapane.TableDataTreePane; import com.fr.design.data.datapane.TableDataTreePane;
@ -219,7 +220,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
@Override @Override
public void mouseReleased(MouseEvent e) { public void mouseReleased(MouseEvent e) {
if (DesignModeContext.isAuthorityEditing()) { if (DesignModeContext.isAuthorityEditing()) {
closeAuthorityEditing(); DesignModeContext.switchTo(DesignerMode.NORMAL);
} }
} }
@ -299,8 +300,12 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().doResize(); HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().doResize();
} }
@Deprecated
public void closeAuthorityEditing() { public void closeAuthorityEditing() {
DesignModeContext.switchTo(com.fr.design.base.mode.DesignerMode.NORMAL); DesignModeContext.switchTo(DesignerMode.NORMAL);
}
public void closeAuthorityMode() {
WestRegionContainerPane.getInstance().replaceDownPane( WestRegionContainerPane.getInstance().replaceDownPane(
TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter())); TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()));
HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().refreshEastPropertiesPane(); HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().refreshEastPropertiesPane();
@ -312,6 +317,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
EventDispatcher.fire(DesignAuthorityEventType.StopEdit, DesignerFrame.this); EventDispatcher.fire(DesignAuthorityEventType.StopEdit, DesignerFrame.this);
} }
/** /**
* 注册app. * 注册app.
* *
@ -796,6 +802,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
* @param jt 添加的模板. * @param jt 添加的模板.
*/ */
public void addAndActivateJTemplate(JTemplate<?, ?> jt) { public void addAndActivateJTemplate(JTemplate<?, ?> jt) {
DesignModeContext.switchTo(DesignerMode.NORMAL);
JTemplate currentEditingTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); JTemplate currentEditingTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
if (currentEditingTemplate != null) { if (currentEditingTemplate != null) {
currentEditingTemplate.stopEditing(); currentEditingTemplate.stopEditing();
@ -1038,7 +1045,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
} }
JTemplate jt = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); JTemplate jt = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
if (jt != null) { if (jt != null) {
DesignerEnvManager.getEnvManager().setLastOpenFile(jt.getEditingFILE().getPath()); DesignerEnvManager.getEnvManager().setLastOpenFile(jt.getEditingFILE().getPath());
} }

3
designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java

@ -47,6 +47,7 @@ import com.fr.design.menu.NameSeparator;
import com.fr.design.menu.ShortCut; import com.fr.design.menu.ShortCut;
import com.fr.design.preview.PagePreview; import com.fr.design.preview.PagePreview;
import com.fr.design.ui.util.UIUtil; import com.fr.design.ui.util.UIUtil;
import com.fr.design.utils.DesignUtils;
import com.fr.design.worker.save.CallbackSaveWorker; import com.fr.design.worker.save.CallbackSaveWorker;
import com.fr.design.worker.save.EmptyCallBackSaveWorker; import com.fr.design.worker.save.EmptyCallBackSaveWorker;
import com.fr.design.write.submit.DBManipulationInWidgetEventPane; import com.fr.design.write.submit.DBManipulationInWidgetEventPane;
@ -1071,7 +1072,7 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
public boolean isOldDesigner() { public boolean isOldDesigner() {
String xmlDesignerVersion = getTarget().getXMLDesignerVersion(); String xmlDesignerVersion = getTarget().getXMLDesignerVersion();
if (isHigherThanCurrent(xmlDesignerVersion)) { if (isHigherThanCurrent(xmlDesignerVersion)) {
String infor = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Template_Version_Not_Match", StringUtils.parseVersion(xmlDesignerVersion)); String infor = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Template_Version_Not_Match", DesignUtils.parseVersion(xmlDesignerVersion));
String moreInfo = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Server_Version_Tip_More_Info"); String moreInfo = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Server_Version_Tip_More_Info");
new InformationWarnPane(infor, moreInfo, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tool_Tips")).show(); new InformationWarnPane(infor, moreInfo, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tool_Tips")).show();
return true; return true;

1
designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogMessageBar.java

@ -48,6 +48,7 @@ public class LogMessageBar extends JPanel {
public void mouseClicked(MouseEvent e) { public void mouseClicked(MouseEvent e) {
if (dlg != null && dlg.isVisible()) { if (dlg != null && dlg.isVisible()) {
dlg.setExtendedState(JFrame.NORMAL); dlg.setExtendedState(JFrame.NORMAL);
dlg.requestFocus();
return; return;
} }
dlg = new LogDetailPane().showDialog(); dlg = new LogDetailPane().showDialog();

33
designer-base/src/main/java/com/fr/design/roleAuthority/RolesEditedSourceOP.java

@ -18,21 +18,22 @@ import java.util.Map;
*/ */
public class RolesEditedSourceOP extends RoleSourceOP { public class RolesEditedSourceOP extends RoleSourceOP {
protected ExpandMutableTreeNode[] getNodeArrayFromMap(Map<String, RoleDataWrapper> map) { protected ExpandMutableTreeNode[] getNodeArrayFromMap(Map<String, RoleDataWrapper> map) {
List<ExpandMutableTreeNode> roleList = new ArrayList<ExpandMutableTreeNode>(); List<ExpandMutableTreeNode> roleList = new ArrayList<ExpandMutableTreeNode>();
Iterator<Map.Entry<String, RoleDataWrapper>> entryIt = map.entrySet().iterator(); Iterator<Map.Entry<String, RoleDataWrapper>> entryIt = map.entrySet().iterator();
while (entryIt.hasNext()) { while (entryIt.hasNext()) {
Map.Entry<String, RoleDataWrapper> entry = entryIt.next(); Map.Entry<String, RoleDataWrapper> entry = entryIt.next();
RoleDataWrapper t = entry.getValue(); RoleDataWrapper t = entry.getValue();
JTemplate jt = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); JTemplate jt = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
PrivilegeEditedRoleProvider pe = (PrivilegeEditedRoleProvider) jt.getTarget(); if (jt.getTarget() instanceof PrivilegeEditedRoleProvider) {
PrivilegeEditedRoleProvider pe = (PrivilegeEditedRoleProvider) jt.getTarget();
ExpandMutableTreeNode[] expand = t.load(Arrays.asList(pe.getAllEditedRoleSet())); ExpandMutableTreeNode[] expand = t.load(Arrays.asList(pe.getAllEditedRoleSet()));
for (ExpandMutableTreeNode expandMutableTreeNode : expand) { for (ExpandMutableTreeNode expandMutableTreeNode : expand) {
roleList.add(expandMutableTreeNode); roleList.add(expandMutableTreeNode);
} }
} }
return roleList.toArray(new ExpandMutableTreeNode[roleList.size()]); }
} return roleList.toArray(new ExpandMutableTreeNode[roleList.size()]);
}
} }

13
designer-base/src/main/java/com/fr/design/utils/DesignUtils.java

@ -425,4 +425,17 @@ public class DesignUtils {
return true; return true;
} }
/**
* FR25.0版本出来需要进行适配下
*
* @param xmlDesignerVersion
* @return
*/
public static String parseVersion(String xmlDesignerVersion) {
if (StringUtils.isNotEmpty(xmlDesignerVersion)) {
return String.valueOf(xmlDesignerVersion.charAt(0) - 'A');
}
return xmlDesignerVersion;
}
} }

1
designer-base/src/main/resources/com/fr/design/i18n/dimension_en.properties

@ -7,3 +7,4 @@ com.fr.env.RemoteEnvPane.dialog=458*132
com.fr.design.version.check.dialog=490*95 com.fr.design.version.check.dialog=490*95
com.fr.design.version.detail.label=750*30 com.fr.design.version.detail.label=750*30
com.fr.design.version.detail.dialog=900*500 com.fr.design.version.detail.dialog=900*500
com.fr.design.web.pane.text.field=450*20

1
designer-base/src/main/resources/com/fr/design/i18n/dimension_ja_JP.properties

@ -6,3 +6,4 @@ com.fr.env.RemoteEnvPane.dialog=458*132
com.fr.design.version.check.dialog=430*95 com.fr.design.version.check.dialog=430*95
com.fr.design.version.detail.label=650*30 com.fr.design.version.detail.label=650*30
com.fr.design.version.detail.dialog=800*500 com.fr.design.version.detail.dialog=800*500
com.fr.design.web.pane.text.field=400*20

1
designer-base/src/main/resources/com/fr/design/i18n/dimension_ko_KR.properties

@ -6,3 +6,4 @@ com.fr.env.RemoteEnvPane.dialog=458*132
com.fr.design.version.check.dialog=450*95 com.fr.design.version.check.dialog=450*95
com.fr.design.version.detail.label=700*30 com.fr.design.version.detail.label=700*30
com.fr.design.version.detail.dialog=850*500 com.fr.design.version.detail.dialog=850*500
com.fr.design.web.pane.text.field=450*20

1
designer-base/src/main/resources/com/fr/design/i18n/dimension_zh.properties

@ -7,3 +7,4 @@ com.fr.env.RemoteEnvPane.dialog=308*132
com.fr.design.version.check.dialog=230*95 com.fr.design.version.check.dialog=230*95
com.fr.design.version.detail.label=450*30 com.fr.design.version.detail.label=450*30
com.fr.design.version.detail.dialog=600*500 com.fr.design.version.detail.dialog=600*500
com.fr.design.web.pane.text.field=450*20

1
designer-base/src/main/resources/com/fr/design/i18n/dimension_zh_TW.properties

@ -6,3 +6,4 @@ com.fr.env.RemoteEnvPane.dialog=308*132
com.fr.design.version.check.dialog=230*95 com.fr.design.version.check.dialog=230*95
com.fr.design.version.detail.label=450*30 com.fr.design.version.detail.label=450*30
com.fr.design.version.detail.dialog=600*500 com.fr.design.version.detail.dialog=600*500
com.fr.design.web.pane.text.field=450*20

7
designer-base/src/test/java/com/fr/design/utils/DesignUtilsTest.java

@ -3,6 +3,7 @@ package com.fr.design.utils;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import junit.framework.TestCase; import junit.framework.TestCase;
import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
import java.net.ServerSocket; import java.net.ServerSocket;
@ -29,4 +30,10 @@ public class DesignUtilsTest extends TestCase {
assertTrue(DesignUtils.isPortOccupied()); assertTrue(DesignUtils.isPortOccupied());
} }
@Test
public void testParseVersion() {
Assert.assertEquals("10", DesignUtils.parseVersion("KAA"));
Assert.assertEquals("11", DesignUtils.parseVersion("LAA"));
}
} }

41
designer-chart/src/main/java/com/fr/design/module/ChartPreStyleListPane.java

@ -4,19 +4,28 @@ import com.fr.base.ChartColorMatching;
import com.fr.base.ChartPreStyleConfig; import com.fr.base.ChartPreStyleConfig;
import com.fr.base.Utils; import com.fr.base.Utils;
import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.BasicBeanPane;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.gui.controlpane.JListControlPane; import com.fr.design.gui.controlpane.JListControlPane;
import com.fr.design.gui.controlpane.NameObjectCreator; import com.fr.design.gui.controlpane.NameObjectCreator;
import com.fr.design.gui.controlpane.NameableCreator; import com.fr.design.gui.controlpane.NameableCreator;
import com.fr.design.gui.controlpane.ShortCut4JControlPane; import com.fr.design.gui.controlpane.ShortCut4JControlPane;
import com.fr.design.gui.ilist.JNameEdList;
import com.fr.design.gui.ilist.ModNameActionListener; import com.fr.design.gui.ilist.ModNameActionListener;
import com.fr.design.i18n.Toolkit;
import com.fr.design.menu.ShortCut; import com.fr.design.menu.ShortCut;
import com.fr.general.ComparatorUtils;
import com.fr.general.NameObject; import com.fr.general.NameObject;
import com.fr.stable.Nameable; import com.fr.stable.Nameable;
import com.fr.stable.StringUtils;
import javax.swing.JOptionPane;
import javax.swing.SwingUtilities;
import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener; import javax.swing.event.ListSelectionListener;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator; import java.util.Iterator;
import java.util.List;
/** /**
* @author Bjorn * @author Bjorn
@ -31,6 +40,38 @@ public class ChartPreStyleListPane extends JListControlPane {
super(); super();
this.chartPreStyleManagerPane = chartPreStyleManagerPane; this.chartPreStyleManagerPane = chartPreStyleManagerPane;
initListener(); initListener();
addModNameActionListener((int index, String oldName, String newName) -> {
if (ComparatorUtils.equals(oldName, newName)) {
return;
}
String[] allNames = nameableList.getAllNames();
allNames[index] = StringUtils.EMPTY;
if (StringUtils.isEmpty(newName)) {
showTipDialog(Toolkit.i18nText("Fine-Design_Chart_Fill_Style_Empty_Name_Tip"));
nameableList.setNameAt(oldName, index);
return;
}
if (isNameRepeated(new List[]{Arrays.asList(allNames)}, newName)) {
showTipDialog(Toolkit.i18nText("Fine-Design_Chart_Fill_Style_Exist_Name_Tip", newName));
nameableList.setNameAt(oldName, index);
return;
}
populateSelectedValue();
});
}
private void showTipDialog(String content) {
FineJOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(ChartPreStyleListPane.this),
content,
Toolkit.i18nText("Fine-Design_Basic_Alert"),
JOptionPane.WARNING_MESSAGE);
}
@Override
protected JNameEdList createJNameList() {
JNameEdList jNameList = super.createJNameList();
jNameList.setReplaceEmptyName(false);
return jNameList;
} }
/** /**

42
designer-form/src/main/java/com/fr/design/designer/creator/XBorderStyleWidgetCreator.java

@ -21,6 +21,8 @@ import com.fr.stable.StringUtils;
import javax.swing.*; import javax.swing.*;
import javax.swing.border.Border; import javax.swing.border.Border;
import javax.swing.border.LineBorder; import javax.swing.border.LineBorder;
import javax.swing.plaf.PanelUI;
import javax.swing.plaf.basic.BasicPanelUI;
import java.awt.*; import java.awt.*;
import java.awt.geom.Rectangle2D; import java.awt.geom.Rectangle2D;
import java.awt.geom.RoundRectangle2D; import java.awt.geom.RoundRectangle2D;
@ -42,12 +44,23 @@ public class XBorderStyleWidgetCreator extends XWidgetCreator{
public XBorderStyleWidgetCreator(Widget widget, Dimension initSize) { public XBorderStyleWidgetCreator(Widget widget, Dimension initSize) {
super(widget, initSize); super(widget, initSize);
setUI(new NoBackgroundPaneUI());
setOpaque(false);
setBackupBound(null);
ExtendSharableAttrMark sharableAttrMark = this.toData().getWidgetAttrMark(ExtendSharableAttrMark.XML_TAG); ExtendSharableAttrMark sharableAttrMark = this.toData().getWidgetAttrMark(ExtendSharableAttrMark.XML_TAG);
if (sharableAttrMark != null) { if (sharableAttrMark != null) {
this.setShareId(sharableAttrMark.getShareId()); this.setShareId(sharableAttrMark.getShareId());
} }
} }
@Override
public void setUI(PanelUI ui) {
if (ui instanceof NoBackgroundPaneUI) {
super.setUI(ui);
}
}
public Background getBackground4Painting() { public Background getBackground4Painting() {
return this.background4Painting; return this.background4Painting;
} }
@ -88,12 +101,12 @@ public class XBorderStyleWidgetCreator extends XWidgetCreator{
super.addToWrapper(parentPanel, width, minHeight); super.addToWrapper(parentPanel, width, minHeight);
// REPORT-53175: 新创建的图表组件默认显示标题 since 10.0.18 // REPORT-53175: 新创建的图表组件默认显示标题 since 10.0.18
// 将当前对象添加到父容器后,初始化默认样式的效果 // 将当前对象添加到父容器后,初始化默认样式的效果
initStyle(); refreshStylePreviewEffect();
} }
protected void initStyle() { public void refreshStylePreviewEffect() {
BorderPacker style = toData().getBorderStyle(); BorderPacker style = toData().getBorderStyle();
initBorderAndBackgroundStyle(); refreshBorderAndBackgroundStylePreviewEffect();
if (ComparatorUtils.equals(style.getType(), LayoutBorderStyle.TITLE)) { if (ComparatorUtils.equals(style.getType(), LayoutBorderStyle.TITLE)) {
initTitleStyle(style); initTitleStyle(style);
} else { } else {
@ -104,7 +117,7 @@ public class XBorderStyleWidgetCreator extends XWidgetCreator{
reshuffleBorderAndBackgroundPaintingEffectIfTitleExists(); reshuffleBorderAndBackgroundPaintingEffectIfTitleExists();
} }
protected void initBorderAndBackgroundStyle() { public void refreshBorderAndBackgroundStylePreviewEffect() {
BorderPacker style = toData().getBorderStyle(); BorderPacker style = toData().getBorderStyle();
LineBorder DEFAULT_LINE_BORDER = (LineBorder) DEFALUTBORDER; LineBorder DEFAULT_LINE_BORDER = (LineBorder) DEFALUTBORDER;
@ -263,6 +276,11 @@ public class XBorderStyleWidgetCreator extends XWidgetCreator{
} }
@Override
public void setBackground(Color bg) {
super.setBackground(bg);
}
// 根据当前组件边框裁剪内容,如果当前组件存在圆角,则应当按圆角裁剪内容 // 根据当前组件边框裁剪内容,如果当前组件存在圆角,则应当按圆角裁剪内容
private void clipByRoundedBorder(Graphics2D g2d) { private void clipByRoundedBorder(Graphics2D g2d) {
Border currentBorder = getBorder(); Border currentBorder = getBorder();
@ -280,6 +298,11 @@ public class XBorderStyleWidgetCreator extends XWidgetCreator{
// 设计器预览界面中绘制组件背景效果 // 设计器预览界面中绘制组件背景效果
public void paintBackground(Graphics2D g2d) { public void paintBackground(Graphics2D g2d) {
if (isOpaque()) {
g2d.setColor(getBackground());
g2d.fillRect(0, 0, getWidth(), getHeight());
}
Background background4Painting = getBackground4Painting(); Background background4Painting = getBackground4Painting();
if (background4Painting != null) { if (background4Painting != null) {
Composite oldComposite = g2d.getComposite(); Composite oldComposite = g2d.getComposite();
@ -303,12 +326,12 @@ public class XBorderStyleWidgetCreator extends XWidgetCreator{
} }
public void paintForeground(Graphics2D g2d) { public void paintForeground(Graphics2D g2d) {
super.paint(g2d); super.paintComponent(g2d);
super.paintBorder(g2d); super.paintBorder(g2d);
} }
@Override @Override
public void paint(Graphics g) { public void paintComponent(Graphics g) {
this.clipByRoundedBorder((Graphics2D) g); this.clipByRoundedBorder((Graphics2D) g);
this.paintBackground((Graphics2D) g); this.paintBackground((Graphics2D) g);
this.paintBorderImage((Graphics2D) g); this.paintBorderImage((Graphics2D) g);
@ -370,4 +393,11 @@ public class XBorderStyleWidgetCreator extends XWidgetCreator{
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
} }
} }
public static class NoBackgroundPaneUI extends BasicPanelUI {
@Override
public void update(Graphics g, JComponent c) {
paint(g, c);
}
}
} }

15
designer-form/src/main/java/com/fr/design/designer/creator/XChartEditor.java

@ -122,7 +122,7 @@ public class XChartEditor extends XBorderStyleWidgetCreator {
@Override @Override
public void propertyChange() { public void propertyChange() {
initStyle(); refreshStylePreviewEffect();
} }
}), }),
}; };
@ -165,7 +165,7 @@ public class XChartEditor extends XBorderStyleWidgetCreator {
@Override @Override
protected void initXCreatorProperties() { protected void initXCreatorProperties() {
super.initXCreatorProperties(); super.initXCreatorProperties();
initBorderAndBackgroundStyle(); refreshBorderAndBackgroundStylePreviewEffect();
BaseChartCollection collection = ((BaseChartEditor) data).getChartCollection(); BaseChartCollection collection = ((BaseChartEditor) data).getChartCollection();
isRefreshing = true; isRefreshing = true;
((MiddleChartComponent) designerEditor.getEditorTarget()).populate(collection); ((MiddleChartComponent) designerEditor.getEditorTarget()).populate(collection);
@ -232,7 +232,14 @@ public class XChartEditor extends XBorderStyleWidgetCreator {
Dimension size = getSize(); Dimension size = getSize();
PaddingMargin margin = toData().getMargin(); PaddingMargin margin = toData().getMargin();
designerEditor.paintEditor(g, size, margin); if (!isEditing) {
// CHART-20568 & CHART-20627
// EditingMouseListener#startEditing会将图表的ChartComponent放入FormDesigner, 作为编辑中的ChartComponent来显示,
// 同时这里又在下层绘制了一遍ChartComponent,导致图表进入编辑状态,会出现两个重叠的ChartComponent。
// 考虑到编辑中,FormDesigner中的ChartComponent位于上层,下层的ChartComponent实际上没什么用,所以可以不用绘制
// 下层的ChartComponent
designerEditor.paintEditor(g, size, margin);
}
if (coverPanel != null) { if (coverPanel != null) {
int horizonMargin = margin != null ? margin.getLeft() + margin.getRight() : 0; int horizonMargin = margin != null ? margin.getLeft() + margin.getRight() : 0;
@ -334,7 +341,7 @@ public class XChartEditor extends XBorderStyleWidgetCreator {
* data属性改变触发其他操作 * data属性改变触发其他操作
*/ */
public void firePropertyChange() { public void firePropertyChange() {
initStyle(); refreshStylePreviewEffect();
} }
@Override @Override

20
designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java

@ -787,7 +787,7 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo
int formDesignerWidth = designer.getWidth(); int formDesignerWidth = designer.getWidth();
int formDesignerHeight = designer.getHeight(); int formDesignerHeight = designer.getHeight();
// 不超过可绘制区域 // 不超过可绘制区域
int extraX = Math.min(creatorRightX, formDesignerWidth); int extraX = creatorRightX < 0 ? 0 : Math.min(creatorRightX, formDesignerWidth);
int extraY = creatorRightY < 0 ? 0 : Math.min(creatorRightY, formDesignerHeight); int extraY = creatorRightY < 0 ? 0 : Math.min(creatorRightY, formDesignerHeight);
if (designer.isFormParaDesigner() && extraY + this.getHeight() >= formDesignerHeight) { if (designer.isFormParaDesigner() && extraY + this.getHeight() >= formDesignerHeight) {
@ -799,10 +799,20 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo
SwingUtilities.invokeLater(new Runnable() { SwingUtilities.invokeLater(new Runnable() {
@Override @Override
public void run() { public void run() {
popup.setLocation(designer.getLocationOnScreen().x + designer.getPaintX() + extraX, designer.getLocationOnScreen().y + designer.getPaintY() + extraY); try {
popup.updatePane(designer); popup.setLocation(designer.getLocationOnScreen().x + designer.getPaintX() + extraX, designer.getLocationOnScreen().y + designer.getPaintY() + extraY);
popup.setVisible(selected && accept && popup.hasVisibleButtons() && popup.isCanVisible() && !isShowPluginDialog()); popup.updatePane(designer);
popup.setRelativeBounds(bounds); boolean needShowing = selected && accept && popup.hasVisibleButtons() && popup.isCanVisible() && !isShowPluginDialog();
// 当不可见时,且可以设置为可见状态,才去设置为可见
// 避免已经是可见状态时,重复设置可见,造成闪屏
if (!popup.isVisible() && needShowing) {
popup.setVisible(true);
} else if (!needShowing) {
popup.setVisible(false);
}
popup.setRelativeBounds(bounds);
} catch (Exception ignored) {
}
} }
}); });
} }

17
designer-form/src/main/java/com/fr/design/designer/creator/XElementCase.java

@ -33,7 +33,7 @@ import java.beans.IntrospectionException;
import java.beans.PropertyDescriptor; import java.beans.PropertyDescriptor;
import java.util.Set; import java.util.Set;
public class XElementCase extends XBorderStyleWidgetCreator implements FormElementCaseContainerProvider , Releasable { public class XElementCase extends XBorderStyleWidgetCreator implements FormElementCaseContainerProvider, Releasable {
private UILabel imageLable; private UILabel imageLable;
private FormDesigner designer; private FormDesigner designer;
private static BufferedImage DEFAULT_BACKGROUND; private static BufferedImage DEFAULT_BACKGROUND;
@ -58,7 +58,7 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme
super.initXCreatorProperties(); super.initXCreatorProperties();
// 报表块初始化时要加载对应的borderStyle // 报表块初始化时要加载对应的borderStyle
initBorderAndBackgroundStyle(); refreshBorderAndBackgroundStylePreviewEffect();
} }
/** /**
@ -94,7 +94,7 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme
@Override @Override
public void propertyChange() { public void propertyChange() {
initStyle(); refreshStylePreviewEffect();
} }
}), }),
new CRPropertyDescriptor("margin", this.data.getClass()).setEditorClass(PaddingMarginEditor.class) new CRPropertyDescriptor("margin", this.data.getClass()).setEditorClass(PaddingMarginEditor.class)
@ -269,6 +269,12 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme
return toData().getElementCase(); return toData().getElementCase();
} }
@Override
public void doLayout() {
super.doLayout();
this.updateECImage();
}
public String getElementCaseContainerName() { public String getElementCaseContainerName() {
return toData().getWidgetName(); return toData().getWidgetName();
} }
@ -321,9 +327,8 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme
FormDesigner designer = editingMouseListener.getDesigner(); FormDesigner designer = editingMouseListener.getDesigner();
if (e.getButton() == MouseEvent.BUTTON1 && if (e.getButton() == MouseEvent.BUTTON1 &&
(e.getClickCount() == 2 || designer.getCursor().getType() == Cursor.HAND_CURSOR)) { (e.getClickCount() == 2 || designer.getCursor().getType() == Cursor.HAND_CURSOR)) {
FormElementCaseContainerProvider component = (FormElementCaseContainerProvider) designer.getComponentAt(e);
//切换设计器 //切换设计器
designer.switchTab(component); designer.switchTab(this);
} }
} }
@ -337,7 +342,7 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme
* *
*/ */
public void firePropertyChange() { public void firePropertyChange() {
initStyle(); refreshStylePreviewEffect();
} }
/** /**

6
designer-form/src/main/java/com/fr/design/designer/creator/XLayoutContainer.java

@ -75,7 +75,7 @@ public abstract class XLayoutContainer extends XBorderStyleWidgetCreator impleme
@Override @Override
public void propertyChange() { public void propertyChange() {
initStyle(); refreshStylePreviewEffect();
} }
}), }),
new CRPropertyDescriptor("margin", this.data.getClass()).setEditorClass(PaddingMarginEditor.class) new CRPropertyDescriptor("margin", this.data.getClass()).setEditorClass(PaddingMarginEditor.class)
@ -118,7 +118,7 @@ public abstract class XLayoutContainer extends XBorderStyleWidgetCreator impleme
@Override @Override
protected void initXCreatorProperties() { protected void initXCreatorProperties() {
super.initXCreatorProperties(); super.initXCreatorProperties();
initBorderAndBackgroundStyle(); refreshBorderAndBackgroundStylePreviewEffect();
this.initLayoutManager(); this.initLayoutManager();
this.convert(); this.convert();
} }
@ -547,7 +547,7 @@ public abstract class XLayoutContainer extends XBorderStyleWidgetCreator impleme
* *
*/ */
public void firePropertyChange(){ public void firePropertyChange(){
initStyle(); refreshStylePreviewEffect();
} }
/** /**

8
designer-form/src/main/java/com/fr/design/designer/creator/XWAbsoluteBodyLayout.java

@ -78,7 +78,7 @@ public class XWAbsoluteBodyLayout extends XWAbsoluteLayout {
@Override @Override
public void propertyChange() { public void propertyChange() {
initStyle(); XWAbsoluteBodyLayout.this.refreshStylePreviewEffect();
} }
}) })
}; };
@ -105,8 +105,8 @@ public class XWAbsoluteBodyLayout extends XWAbsoluteLayout {
} }
@Override @Override
protected void initStyle() { public void refreshStylePreviewEffect() {
initBorderAndBackgroundStyle(); refreshBorderAndBackgroundStylePreviewEffect();
} }
/** /**
@ -114,7 +114,7 @@ public class XWAbsoluteBodyLayout extends XWAbsoluteLayout {
* *
*/ */
public void firePropertyChange(){ public void firePropertyChange(){
initStyle(); this.refreshStylePreviewEffect();
} }
@Override @Override

2
designer-form/src/main/java/com/fr/design/designer/creator/XWAbsoluteLayout.java

@ -305,7 +305,7 @@ public class XWAbsoluteLayout extends XLayoutContainer {
} }
@Override @Override
protected void initStyle() { public void refreshStylePreviewEffect() {
// do nothing // do nothing
} }

2
designer-form/src/main/java/com/fr/design/designer/creator/XWTitleLayout.java

@ -63,7 +63,7 @@ public class XWTitleLayout extends DedicateLayoutContainer {
} }
@Override @Override
protected void initBorderAndBackgroundStyle() { public void refreshBorderAndBackgroundStylePreviewEffect() {
setBorder(null); setBorder(null);
setBorderImage4Painting(null, 0.0); setBorderImage4Painting(null, 0.0);
setBackground4Painting(null, 0.0); setBackground4Painting(null, 0.0);

10
designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardLayout.java

@ -160,7 +160,7 @@ public class XWCardLayout extends XLayoutContainer {
*/ */
@Override @Override
protected XLayoutContainer getCreatorWrapper(String widgetName) { protected XLayoutContainer getCreatorWrapper(String widgetName) {
initStyle(); refreshStylePreviewEffect();
Dimension dimension = new Dimension(); Dimension dimension = new Dimension();
//主结构是一个borderlayout, 标签部分是north, card部分为center //主结构是一个borderlayout, 标签部分是north, card部分为center
WCardMainBorderLayout border = new WCardMainBorderLayout(); WCardMainBorderLayout border = new WCardMainBorderLayout();
@ -389,7 +389,7 @@ public class XWCardLayout extends XLayoutContainer {
@Override @Override
public void propertyChange() { public void propertyChange() {
initStyle(); refreshStylePreviewEffect();
} }
}) })
}; };
@ -397,10 +397,10 @@ public class XWCardLayout extends XLayoutContainer {
//初始化样式 //初始化样式
@Override @Override
protected void initStyle() { public void refreshStylePreviewEffect() {
BorderPacker style = toData().getBorderStyle(); BorderPacker style = toData().getBorderStyle();
initBorderTitleStyle(style); initBorderTitleStyle(style);
initBorderAndBackgroundStyle(); refreshBorderAndBackgroundStylePreviewEffect();
clearOrShowTitleLayout(ComparatorUtils.equals(style.getType(), LayoutBorderStyle.TITLE)); clearOrShowTitleLayout(ComparatorUtils.equals(style.getType(), LayoutBorderStyle.TITLE));
} }
@ -484,7 +484,7 @@ public class XWCardLayout extends XLayoutContainer {
*/ */
@Override @Override
public void firePropertyChange() { public void firePropertyChange() {
initStyle(); refreshStylePreviewEffect();
} }
public void resetTabBackground(TemplateStyle templateStyle) { public void resetTabBackground(TemplateStyle templateStyle) {

2
designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardMainBorderLayout.java

@ -417,7 +417,7 @@ public class XWCardMainBorderLayout extends XWBorderLayout {
public void firePropertyChange(){ public void firePropertyChange(){
XWCardLayout cardLayout = this.getCardPart(); XWCardLayout cardLayout = this.getCardPart();
if (cardLayout != null && cardLayout.toData() != null) { if (cardLayout != null && cardLayout.toData() != null) {
cardLayout.initStyle(); cardLayout.refreshStylePreviewEffect();
} }
} }

2
designer-form/src/main/java/com/fr/design/mainframe/FormArea.java

@ -177,14 +177,12 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
double[] rowSize = {f}; double[] rowSize = {f};
double[] columnSize = {p, f, p, p, p, p, p, f, p}; double[] columnSize = {p, f, p, p, p, p, p, f, p};
UILabel tipsPane = new UILabel("form"); UILabel tipsPane = new UILabel("form");
tipsPane.setPreferredSize(new Dimension(265, 0));
widthPane = new UINumberField(); widthPane = new UINumberField();
widthPane.setPreferredSize(new Dimension(60, 0)); widthPane.setPreferredSize(new Dimension(60, 0));
heightPane = new UINumberField(); heightPane = new UINumberField();
heightPane.setPreferredSize(new Dimension(60, 0)); heightPane.setPreferredSize(new Dimension(60, 0));
slidePane = JFormSliderPane.getInstance(); slidePane = JFormSliderPane.getInstance();
slidePane.setPreferredSize(new Dimension(326, 20));
JPanel resizePane = TableLayoutHelper.createCommonTableLayoutPane( JPanel resizePane = TableLayoutHelper.createCommonTableLayoutPane(
new JComponent[][]{{tipsPane, new UILabel(), widthPane, new JComponent[][]{{tipsPane, new UILabel(), widthPane,

8
designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java

@ -109,6 +109,10 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
Arrays.asList(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_M_Edit_Cut"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_M_Edit_Copy"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_M_Edit_Delete")}) Arrays.asList(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_M_Edit_Cut"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_M_Edit_Copy"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_M_Edit_Delete")})
); );
protected static final ArrayList<String> PARAMETER_TOOLAR_BAN_LIST = new ArrayList<String>(
Arrays.asList(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_M_Edit_Cut"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_M_Edit_Copy")})
);
private double scale = 1.0D; private double scale = 1.0D;
//底层容器的默认大小 //底层容器的默认大小
@ -1304,6 +1308,10 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
protected void setToolbarButtons() { protected void setToolbarButtons() {
//自适应布局和底层都不能删除 //自适应布局和底层都不能删除
DesignerContext.getDesignerFrame().checkCombineUp(!isRootSelected(), NAME_ARRAY_LIST); DesignerContext.getDesignerFrame().checkCombineUp(!isRootSelected(), NAME_ARRAY_LIST);
if (isParameterSelected()) {
DesignerContext.getDesignerFrame().checkCombineUp(false, PARAMETER_TOOLAR_BAN_LIST);
}
} }
private void invalidateLayout() { private void invalidateLayout() {

21
designer-form/src/main/java/com/fr/design/mainframe/FormSelection.java

@ -294,7 +294,6 @@ public class FormSelection {
creator.setBackupBound(backupBounds); creator.setBackupBound(backupBounds);
} }
layoutAdapter.fix(creator); layoutAdapter.fix(creator);
resetElementCaseImage(creator);
} }
i++; i++;
} }
@ -322,26 +321,6 @@ public class FormSelection {
return false; return false;
} }
/**
* @Description 重置报表块缩略图
* @param: creator
* @return void
* @Author Henry.Wang
* @Date 2021/5/21 14:59
**/
public void resetElementCaseImage(XCreator creator) {
if (creator instanceof XWTitleLayout) {
XWTitleLayout xwTitleLayout = (XWTitleLayout) creator;
for (int i = 0; i < xwTitleLayout.getComponentCount(); i++) {
Component component = xwTitleLayout.getComponent(i);
if (component instanceof XElementCase) {
XElementCase xElementCase = (XElementCase) component;
xElementCase.updateECImage();
}
}
}
}
/** /**
* 检查下有没有参数面板如果存在处理下参数面板造成的偏移量 * 检查下有没有参数面板如果存在处理下参数面板造成的偏移量
* @param rectangle * @param rectangle

8
designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRAbsoluteBodyLayoutDefinePane.java

@ -24,6 +24,8 @@ import com.fr.form.ui.LayoutBorderStyle;
import com.fr.form.ui.container.WAbsoluteBodyLayout; import com.fr.form.ui.container.WAbsoluteBodyLayout;
import com.fr.form.ui.container.WAbsoluteLayout; import com.fr.form.ui.container.WAbsoluteLayout;
import com.fr.form.ui.container.WBodyLayoutType; import com.fr.form.ui.container.WBodyLayoutType;
import com.fr.form.ui.container.WFitLayout;
import com.fr.general.act.BorderPacker;
import com.fr.report.core.ReportUtils; import com.fr.report.core.ReportUtils;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
@ -150,7 +152,13 @@ public class FRAbsoluteBodyLayoutDefinePane extends FRAbsoluteLayoutDefinePane {
if (state == WBodyLayoutType.FIT.getTypeValue()) { if (state == WBodyLayoutType.FIT.getTypeValue()) {
XWFitLayout xwFitLayout = ((XWFitLayout)creator.getBackupParent()); XWFitLayout xwFitLayout = ((XWFitLayout)creator.getBackupParent());
xwFitLayout.switch2FitBodyLayout(creator); xwFitLayout.switch2FitBodyLayout(creator);
WFitLayout wFitLayout = xwFitLayout.toData();
// 切换布局类型时,保留body背景样式
if (wFitLayout != null) {
wFitLayout.setBorderStyle(layout.getBorderStyle());
}
copyLayoutAttr(layout, xwFitLayout.toData()); copyLayoutAttr(layout, xwFitLayout.toData());
xwFitLayout.refreshStylePreviewEffect();
} }
} }
layout.setBorderStyle(stylePane.updateBean()); layout.setBorderStyle(stylePane.updateBean());

14
designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRFitLayoutDefinePane.java

@ -34,10 +34,12 @@ import com.fr.form.ui.container.WAbsoluteLayout;
import com.fr.form.ui.container.WBodyLayoutType; import com.fr.form.ui.container.WBodyLayoutType;
import com.fr.form.ui.container.WFitLayout; import com.fr.form.ui.container.WFitLayout;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.act.BorderPacker;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.report.core.ReportUtils; import com.fr.report.core.ReportUtils;
import javax.swing.*; import javax.swing.*;
import javax.swing.border.Border;
import java.awt.*; import java.awt.*;
/** /**
@ -191,9 +193,12 @@ public class FRFitLayoutDefinePane extends AbstractFRLayoutDefinePane<WFitLayout
layout.setLayoutType(WBodyLayoutType.parse(state)); layout.setLayoutType(WBodyLayoutType.parse(state));
layout.setCompState(adaptComboBox.getSelectedIndex()); layout.setCompState(adaptComboBox.getSelectedIndex());
try { try {
// 自适应布局切换到绝对布局
if (state == WBodyLayoutType.ABSOLUTE.getTypeValue()) { if (state == WBodyLayoutType.ABSOLUTE.getTypeValue()) {
WAbsoluteBodyLayout wAbsoluteBodyLayout = new WAbsoluteBodyLayout("body"); WAbsoluteBodyLayout wAbsoluteBodyLayout = new WAbsoluteBodyLayout("body");
wAbsoluteBodyLayout.setCompState(WAbsoluteLayout.STATE_FIXED); wAbsoluteBodyLayout.setCompState(WAbsoluteLayout.STATE_FIXED);
// 切换布局类型时,保留body背景样式
wAbsoluteBodyLayout.setBorderStyle((BorderPacker) (layout.getBorderStyle().clone()));
Component[] components = xWFitLayout.getComponents(); Component[] components = xWFitLayout.getComponents();
xWFitLayout.removeAll(); xWFitLayout.removeAll();
layout.resetStyle(); layout.resetStyle();
@ -215,6 +220,15 @@ public class FRFitLayoutDefinePane extends AbstractFRLayoutDefinePane<WFitLayout
FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner(); FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner();
formDesigner.getSelectionModel().setSelectedCreators( formDesigner.getSelectionModel().setSelectedCreators(
FormSelectionUtils.rebuildSelection(xWFitLayout, new Widget[]{wAbsoluteBodyLayout})); FormSelectionUtils.rebuildSelection(xWFitLayout, new Widget[]{wAbsoluteBodyLayout}));
if (xwAbsoluteBodyLayout.toData() != null) {
xwAbsoluteBodyLayout.toData().setBorderStyle(wAbsoluteBodyLayout.getBorderStyle());
}
xwAbsoluteBodyLayout.refreshStylePreviewEffect();
if (xWFitLayout.toData() != null) {
xWFitLayout.toData().resetStyle();
}
xWFitLayout.refreshStylePreviewEffect();
} }
} catch (Exception e) { } catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);

21
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java

@ -57,8 +57,6 @@ import javax.swing.KeyStroke;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
import javax.swing.SwingWorker; import javax.swing.SwingWorker;
import javax.swing.Timer; import javax.swing.Timer;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import java.awt.AWTEvent; import java.awt.AWTEvent;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Color; import java.awt.Color;
@ -242,21 +240,28 @@ public class AlphaFineDialog extends UIDialog {
if (hotData == null) { if (hotData == null) {
hotData = HotIssuesManager.getInstance().getHotIssues(); hotData = HotIssuesManager.getInstance().getHotIssues();
} }
for (int i = 0; i < hotData.length; i++) {
panel.add(new HotIssueJpanel(hotData[i], i + 1));
}
} else { } else {
hotData = null; hotData = null;
for (int i = 0; i < AlphaFineConstants.HOT_ITEMS; i++) {
panel.add(new HotIssueJpanel(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Connection_Failed")}, i + 1));
}
} }
initHotPane(panel, hotData);
hotPane.add(uiLabel, BorderLayout.NORTH); hotPane.add(uiLabel, BorderLayout.NORTH);
hotPane.add(panel, BorderLayout.CENTER); hotPane.add(panel, BorderLayout.CENTER);
add(hotPane, BorderLayout.SOUTH); add(hotPane, BorderLayout.SOUTH);
setSize(AlphaFineConstants.FULL_SIZE); setSize(AlphaFineConstants.FULL_SIZE);
} }
private void initHotPane(JPanel panel, String[][] hotData) {
if (hotData == null) {
for (int i = 0; i < AlphaFineConstants.HOT_ITEMS; i++) {
panel.add(new HotIssueJpanel(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Connection_Failed")}, i + 1));
}
} else {
for (int i = 0; i < hotData.length; i++) {
panel.add(new HotIssueJpanel(hotData[i], i + 1));
}
}
}
/** /**
* 初始化输入框 * 初始化输入框
*/ */

4
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/HotIssuesManager.java

@ -20,6 +20,7 @@ import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import org.jetbrains.annotations.Nullable;
/** /**
@ -71,6 +72,7 @@ public class HotIssuesManager {
* 从热门问题接口获取热门问题 * 从热门问题接口获取热门问题
* @return * @return
*/ */
@Nullable
public String[][] getHotIssues() { public String[][] getHotIssues() {
try { try {
@ -84,7 +86,7 @@ public class HotIssuesManager {
} }
} }
} catch (Exception e) { } catch (Exception e) {
FineLoggerFactory.getLogger().error("hotissues search error: " + e.getMessage()); FineLoggerFactory.getLogger().error("hotissues search error: " + e.getMessage(), e);
return null; return null;
} }
return data; return data;

5
designer-realize/src/main/java/com/fr/design/mainframe/app/FormApp.java

@ -21,6 +21,8 @@ import com.fr.form.main.Form;
import com.fr.form.ui.container.WBorderLayout; import com.fr.form.ui.container.WBorderLayout;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.report.util.ReadXmlType;
import com.fr.report.util.ReadXmlTypeLocalManager;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import com.fr.stable.bridge.StableFactory; import com.fr.stable.bridge.StableFactory;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
@ -90,13 +92,16 @@ class FormApp extends AbstractAppProvider {
@Nullable @Nullable
private Form getForm(FILE tplFile) { private Form getForm(FILE tplFile) {
ReadXmlTypeLocalManager.setReadXmlType(ReadXmlType.DESIGN);
Form form = asIOFile(tplFile); Form form = asIOFile(tplFile);
ReadXmlTypeLocalManager.remove();
if (form != null) { if (form != null) {
DesignerAppUtils.dealWithTemplateIOError(tplFile.getPath()); DesignerAppUtils.dealWithTemplateIOError(tplFile.getPath());
} }
return form; return form;
} }
@Override @Override
public Form asIOFile(FILE file) { public Form asIOFile(FILE file) {

3
designer-realize/src/main/java/com/fr/design/mainframe/form/FormElementCaseDesigner.java

@ -152,10 +152,13 @@ public class FormElementCaseDesigner
Grid grid = this.elementCasePane != null ? this.elementCasePane.getGrid() : null; Grid grid = this.elementCasePane != null ? this.elementCasePane.getGrid() : null;
if (grid != null) { if (grid != null) {
boolean oldTranslucent = grid.isTranslucent(); boolean oldTranslucent = grid.isTranslucent();
boolean oldShowExtraGridLine = grid.isShowExtraGridLine();
// 截缩图图时grid需支持半透明,不能用默认白色填充画布,否则会遮挡组件样式背景 // 截缩图图时grid需支持半透明,不能用默认白色填充画布,否则会遮挡组件样式背景
grid.setTranslucent(true); grid.setTranslucent(true);
grid.setShowExtraGridLine(false);
grid.paint(g2d); grid.paint(g2d);
grid.setTranslucent(oldTranslucent); grid.setTranslucent(oldTranslucent);
grid.setShowExtraGridLine(oldShowExtraGridLine);
} }
} catch (Exception e) { } catch (Exception e) {

3
designer-realize/src/main/java/com/fr/design/webattr/WebCssPane.java

@ -5,6 +5,7 @@ import com.fr.design.gui.frpane.EditingStringListPane;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.i18n.DesignSizeI18nManager;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.widget.FRWidgetFactory; import com.fr.design.widget.FRWidgetFactory;
import com.fr.file.FILE; import com.fr.file.FILE;
@ -38,7 +39,7 @@ public class WebCssPane extends BasicPane {
JPanel outnorth = new JPanel(new BorderLayout(0, 5)); JPanel outnorth = new JPanel(new BorderLayout(0, 5));
JPanel northPane = new JPanel(new FlowLayout(FlowLayout.LEFT,8,0)); JPanel northPane = new JPanel(new FlowLayout(FlowLayout.LEFT,8,0));
localText = new UITextField(); localText = new UITextField();
localText.setPreferredSize(new Dimension(450, 20)); localText.setPreferredSize(DesignSizeI18nManager.getInstance().i18nDimension("com.fr.design.web.pane.text.field"));
localText.setEditable(false); localText.setEditable(false);
chooseFile = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Selection")); chooseFile = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Selection"));
chooseFile.setPreferredSize(new Dimension(75, 23)); chooseFile.setPreferredSize(new Dimension(75, 23));

5
designer-realize/src/main/java/com/fr/design/webattr/WebJsPane.java

@ -7,6 +7,7 @@ import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ibutton.UIRadioButton; import com.fr.design.gui.ibutton.UIRadioButton;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.i18n.DesignSizeI18nManager;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.widget.FRWidgetFactory; import com.fr.design.widget.FRWidgetFactory;
import com.fr.file.FILE; import com.fr.file.FILE;
@ -66,8 +67,8 @@ public class WebJsPane extends BasicPane {
localText = new UITextField(); localText = new UITextField();
localText.setEditable(false); localText.setEditable(false);
urlText = new UITextField(); urlText = new UITextField();
localText.setPreferredSize(new Dimension(450, 20)); localText.setPreferredSize(DesignSizeI18nManager.getInstance().i18nDimension("com.fr.design.web.pane.text.field"));
urlText.setPreferredSize(new Dimension(450, 20)); urlText.setPreferredSize(DesignSizeI18nManager.getInstance().i18nDimension("com.fr.design.web.pane.text.field"));
urlText.addKeyListener(urlTextListener); urlText.addKeyListener(urlTextListener);
urlText.setEnabled(false); urlText.setEnabled(false);
chooseFile = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Selection")); chooseFile = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Selection"));

20
designer-realize/src/main/java/com/fr/grid/AbstractGridHeaderMouseHandler.java

@ -152,13 +152,11 @@ public abstract class AbstractGridHeaderMouseHandler extends MouseInputAdapter {
private ScrollAction PRESS_ACTION = new ScrollAction() { private ScrollAction PRESS_ACTION = new ScrollAction() {
@Override @Override
public boolean run(MouseEvent evt, int index, double tmpSize1, double tmpSize2, int tmpIncreaseSize, int oldEndValueSize, ElementCase report, DynamicUnitList sizeList) { public boolean run(MouseEvent evt, int index, double tmpSize1, double tmpSize2, int tmpIncreaseSize, int oldEndValueSize, ElementCase report, DynamicUnitList sizeList) {
// int resolution = ScreenResolution.getScreenResolution();
if (isOnSeparatorLineIncludeZero(evt, tmpSize2, tmpIncreaseSize) || isOnNormalSeparatorLine(evt, tmpSize2)) { if (isOnSeparatorLineIncludeZero(evt, tmpSize2, tmpIncreaseSize) || isOnNormalSeparatorLine(evt, tmpSize2)) {
dragType = GridUtils.DRAG_CELL_SIZE; dragType = GridUtils.DRAG_CELL_SIZE;
isDragPermited = true; isDragPermited = true;
dragIndex = index; dragIndex = index;
showToolTip(evt, createToolTipString(sizeList.get(dragIndex).toPixD(resolution), sizeList.getRangeValue(0, dragIndex + 1).toPixD(resolution))); showToolTip(evt, createToolTipString(sizeList.get(dragIndex), sizeList.getRangeValue(0, dragIndex + 1)));
return true; return true;
} }
if (between(evt, tmpSize1, tmpSize2)) { if (between(evt, tmpSize1, tmpSize2)) {
@ -302,21 +300,18 @@ public abstract class AbstractGridHeaderMouseHandler extends MouseInputAdapter {
protected abstract void resetGridSelectionBySelect(int index, ElementCasePane ePane); protected abstract void resetGridSelectionBySelect(int index, ElementCasePane ePane);
private String createToolTipString(double doubleValue, double totalDoubleValue) { private String createToolTipString(UNIT unitValue, UNIT totalUnitValue) {
int unitType = DesignerEnvManager.getEnvManager().getReportLengthUnit(); int unitType = DesignerEnvManager.getEnvManager().getReportLengthUnit();
// int resolution = ScreenResolution.getScreenResolution();
FU ulen = FU.valueOfPix((int) doubleValue, resolution);
FU tulen = FU.valueOfPix((int) totalDoubleValue, resolution);
ReportLengthUNITProvider lengthUNIT = UnitConvertUtil.parseLengthUNIT(unitType); ReportLengthUNITProvider lengthUNIT = UnitConvertUtil.parseLengthUNIT(unitType);
String unit = lengthUNIT.unitText(); String unit = lengthUNIT.unitText();
double len = lengthUNIT.unit2Value4Scale(ulen); double len = lengthUNIT.unit2Value4Scale(unitValue);
double tlen = lengthUNIT.unit2Value4Scale(tulen); double tlen = lengthUNIT.unit2Value4Scale(totalUnitValue);
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append(String.format("%.2f", new Double(len))) sb.append(String.format("%.2f", new Double(len)))
.append('/').append(String.format("%.2f", new Double(tlen))) .append('/').append(String.format("%.2f", new Double(tlen)))
.append(unit).append('(') .append(unit).append('(')
.append((int)(doubleValue)).append('/') .append((int)(unitValue.toPixD(resolution))).append('/')
.append((int)(totalDoubleValue)) .append((int)(totalUnitValue.toPixD(resolution)))
.append(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Px")) .append(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Px"))
.append(')'); .append(')');
return sb.toString(); return sb.toString();
@ -416,8 +411,7 @@ public abstract class AbstractGridHeaderMouseHandler extends MouseInputAdapter {
iterateScrollBar(ePane, evt, DRAG_ACTION); iterateScrollBar(ePane, evt, DRAG_ACTION);
DynamicUnitList sizeList = getSizeList(report); DynamicUnitList sizeList = getSizeList(report);
// int resolution = ScreenResolution.getScreenResolution(); this.setToolTipText2(this.createToolTipString(sizeList.get(dragIndex), sizeList.getRangeValue(0, dragIndex + 1)));
this.setToolTipText2(this.createToolTipString(sizeList.get(dragIndex).toPixD(resolution), sizeList.getRangeValue(0, dragIndex + 1).toPixD(resolution)));
} }
ePane.repaint(); ePane.repaint();

10
designer-realize/src/main/java/com/fr/grid/Grid.java

@ -136,6 +136,8 @@ public class Grid extends BaseGridComponent {
// 截取缩略图时需透明(不能用默认白色填充),否则会遮挡组件样式的背景,其余情况的绘制可以用白色等默认颜色填充 // 截取缩略图时需透明(不能用默认白色填充),否则会遮挡组件样式的背景,其余情况的绘制可以用白色等默认颜色填充
private boolean isTranslucent = false; private boolean isTranslucent = false;
// 是否绘制单元格内容区之外的网格线
private boolean showExtraGridLine = true;
public Grid(int resolution) { public Grid(int resolution) {
this.resolution = resolution; this.resolution = resolution;
@ -1469,4 +1471,12 @@ public class Grid extends BaseGridComponent {
public void setTranslucent(boolean translucent) { public void setTranslucent(boolean translucent) {
isTranslucent = translucent; isTranslucent = translucent;
} }
public boolean isShowExtraGridLine() {
return showExtraGridLine;
}
public void setShowExtraGridLine(boolean showExtraGridLine) {
this.showExtraGridLine = showExtraGridLine;
}
} }

104
designer-realize/src/main/java/com/fr/grid/GridUI.java

@ -10,12 +10,15 @@ import com.fr.base.background.ColorBackground;
import com.fr.base.background.ImageFileBackground; import com.fr.base.background.ImageFileBackground;
import com.fr.base.iofile.attr.WatermarkAttr; import com.fr.base.iofile.attr.WatermarkAttr;
import com.fr.base.vcs.DesignerMode; import com.fr.base.vcs.DesignerMode;
import com.fr.design.DesignerEnvManager;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.fun.ReportLengthUNITProvider;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.ElementCasePane; import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplate;
import com.fr.design.roleAuthority.ReportAndFSManagePane; import com.fr.design.roleAuthority.ReportAndFSManagePane;
import com.fr.design.unit.UnitConvertUtil;
import com.fr.general.Background; import com.fr.general.Background;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.grid.selection.CellSelection; import com.fr.grid.selection.CellSelection;
@ -48,6 +51,7 @@ import com.fr.stable.Constants;
import com.fr.stable.script.CalculatorUtils; import com.fr.stable.script.CalculatorUtils;
import com.fr.stable.unit.FU; import com.fr.stable.unit.FU;
import com.fr.stable.AssistUtils; import com.fr.stable.AssistUtils;
import com.fr.stable.unit.UNIT;
import com.fr.third.antlr.ANTLRException; import com.fr.third.antlr.ANTLRException;
import com.fr.third.guava.collect.HashMultimap; import com.fr.third.guava.collect.HashMultimap;
@ -288,15 +292,25 @@ public class GridUI extends ComponentUI {
} }
} }
} }
GridRange gridRange = GridRange.range(grid.getHorizontalBeginValue(), horizontalEndValue, grid.getVerticalBeginValue(), verticalEndValue) int xBeginIndex = grid.getHorizontalBeginValue();
int xEndIndex = horizontalEndValue;
int yBeginIndex = grid.getVerticalBeginValue();
int yEndIndex = verticalEndValue;
if (!grid.isShowExtraGridLine()) {
xBeginIndex = 0;
xEndIndex = Math.max(0, report.getColumnCount() - 1);
yBeginIndex = 0;
yEndIndex = Math.max(0, report.getRowCount() - 1);
}
GridRange gridRange = GridRange.range(xBeginIndex, xEndIndex, yBeginIndex, yEndIndex)
.rangeList(rowHeightList, columnWidthList) .rangeList(rowHeightList, columnWidthList)
.realSize(realWidth, realHeight); .realSize(realWidth, realHeight);
new DrawVerticalLineHelper(gridRange, grid.isShowGridLine(), new DrawVerticalLineHelper(gridRange, grid.isShowGridLine(), grid.isShowExtraGridLine(),
isShowVerticalPaginateLine, paperPaintHeight, isShowVerticalPaginateLine, paperPaintHeight,
paginateLineList, resolution).iterateStart2End(g2d); paginateLineList, resolution).iterateStart2End(g2d);
new DrawHorizontalLineHelper(gridRange, grid.isShowGridLine(), new DrawHorizontalLineHelper(gridRange, grid.isShowGridLine(), grid.isShowExtraGridLine(),
isShowHorizontalPaginateLine, paperPaintWidth, isShowHorizontalPaginateLine, paperPaintWidth,
paginateLineList, resolution).iterateStart2End(g2d); paginateLineList, resolution).iterateStart2End(g2d);
} }
@ -320,6 +334,7 @@ public class GridUI extends ComponentUI {
protected GridRange gridRange; protected GridRange gridRange;
protected boolean showGridLine; protected boolean showGridLine;
protected boolean showExtraGridLine;
protected boolean showPaginateLine; protected boolean showPaginateLine;
protected double paperPaintSize; protected double paperPaintSize;
@ -332,11 +347,12 @@ public class GridUI extends ComponentUI {
protected static final double THRESHOLD = 1.0E-4D; protected static final double THRESHOLD = 1.0E-4D;
DrawLineHelper(GridRange gridRange, boolean showGridLine, DrawLineHelper(GridRange gridRange, boolean showGridLine, boolean showExtraGridLine,
boolean showPaginateLine, double paperPaintSize, boolean showPaginateLine, double paperPaintSize,
List paginateLineList, int resolution) { List paginateLineList, int resolution) {
this.gridRange = gridRange; this.gridRange = gridRange;
this.showGridLine = showGridLine; this.showGridLine = showGridLine;
this.showExtraGridLine = showExtraGridLine;
this.showPaginateLine = showPaginateLine; this.showPaginateLine = showPaginateLine;
this.paperPaintSize = paperPaintSize; this.paperPaintSize = paperPaintSize;
@ -353,10 +369,10 @@ public class GridUI extends ComponentUI {
private class DrawVerticalLineHelper extends DrawLineHelper { private class DrawVerticalLineHelper extends DrawLineHelper {
DrawVerticalLineHelper(GridRange gridRange, boolean showGridLine, DrawVerticalLineHelper(GridRange gridRange, boolean showGridLine, boolean showExtraGridLine,
boolean showPaginateLine, double paperPaintSize, boolean showPaginateLine, double paperPaintSize,
List paginateLineList, int resolution) { List paginateLineList, int resolution) {
super(gridRange, showGridLine, showPaginateLine, super(gridRange, showGridLine, showExtraGridLine, showPaginateLine,
paperPaintSize, paginateLineList, resolution); paperPaintSize, paginateLineList, resolution);
} }
@ -372,51 +388,58 @@ public class GridUI extends ComponentUI {
@Override @Override
protected void iterateStart2End(Graphics2D g2d) { protected void iterateStart2End(Graphics2D g2d) {
float rowHeight, paperYAxisSumSize = 0, yAxisSumSize = 0; UNIT rowHeight, paperYAxisSumSize = FU.getInstance(0), maxXAxisSumSize = FU.getInstance(0), yAxisSumSize = FU.getInstance(0);
for (int i = 0; i <= gridRange.yEndIndex; i++) { for (int i = 0; i <= gridRange.yEndIndex; i++) {
if (i == 0) { if (i == 0) {
i = gridRange.yBeginIndex; i = gridRange.yBeginIndex;
for (int k = 0; k < gridRange.yBeginIndex; k++) { for (int k = 0; k < gridRange.yBeginIndex; k++) {
rowHeight = gridRange.rowHeightList.get(k).toPixF(resolution); rowHeight = gridRange.rowHeightList.get(k);
paperYAxisSumSize = paperYAxisSumSize.add(rowHeight);
paperYAxisSumSize += rowHeight; if (paperYAxisSumSize.toPixF(resolution) >= paperPaintSize) {
if (paperYAxisSumSize >= paperPaintSize) {
paperYAxisSumSize = rowHeight; paperYAxisSumSize = rowHeight;
} }
} }
} }
rowHeight = gridRange.rowHeightList.get(i).toPixF(resolution);
paperYAxisSumSize += rowHeight; rowHeight = gridRange.rowHeightList.get(i);
paperYAxisSumSize = paperYAxisSumSize.add(rowHeight);
if (showGridLine) { if (showGridLine) {
float columnWidth, xAxisSumSize = 0; UNIT columnWidth, xAxisSumSize = FU.getInstance(0);
for (int j = gridRange.xBeginIndex; j <= gridRange.xEndIndex; j++) { for (int j = gridRange.xBeginIndex; j <= gridRange.xEndIndex; j++) {
columnWidth = gridRange.columnWidthList.get(j).toPixF(resolution); columnWidth = gridRange.columnWidthList.get(j);
if (!mergeCellElementTable.get(CellPosition.value(i - 1, j)).contains(CellPosition.BOTTOM)) { if (!mergeCellElementTable.get(CellPosition.value(i - 1, j)).contains(CellPosition.BOTTOM)) {
tmpLine2D.setLine(xAxisSumSize, yAxisSumSize, xAxisSumSize + columnWidth, yAxisSumSize); tmpLine2D.setLine(xAxisSumSize.toPixF(resolution), yAxisSumSize.toPixF(resolution), xAxisSumSize.add(columnWidth).toPixF(resolution), yAxisSumSize.toPixF(resolution));
g2d.draw(tmpLine2D); g2d.draw(tmpLine2D);
} }
xAxisSumSize += columnWidth; xAxisSumSize = xAxisSumSize.add(columnWidth);
}
if (xAxisSumSize.toPixF(resolution) > maxXAxisSumSize.toPixF(resolution)) {
maxXAxisSumSize = xAxisSumSize;
} }
} }
if (showPaginateLine && paperYAxisSumSize - paperPaintSize > THRESHOLD) { if (showPaginateLine && paperYAxisSumSize.toPixF(resolution) - paperPaintSize > THRESHOLD) {
paginateLineList.add(getPaginateLine2D((int) yAxisSumSize)); paginateLineList.add(getPaginateLine2D((int) yAxisSumSize.toPixF(resolution)));
paperYAxisSumSize = rowHeight; paperYAxisSumSize = rowHeight;
} }
yAxisSumSize += rowHeight; yAxisSumSize = yAxisSumSize.add(rowHeight);
} }
// paint 最后一个横线.. // paint 最后一个横线..
if (showGridLine) { if (showGridLine) {
drawLastLine(g2d, (int) yAxisSumSize); if (showExtraGridLine) {
drawLastLine(g2d, (int) yAxisSumSize.toPixF(resolution));
} else {
GraphHelper.drawLine(g2d, 0, yAxisSumSize.toPixF(resolution), maxXAxisSumSize.toPixF(resolution), yAxisSumSize.toPixF(resolution));
}
} }
} }
} }
private class DrawHorizontalLineHelper extends DrawLineHelper { private class DrawHorizontalLineHelper extends DrawLineHelper {
DrawHorizontalLineHelper(GridRange gridRange, boolean showGridLine, DrawHorizontalLineHelper(GridRange gridRange, boolean showGridLine, boolean showExtraGridLine,
boolean showPaginateLine, double paperPaintSize, boolean showPaginateLine, double paperPaintSize,
List paginateLineList, int resolution) { List paginateLineList, int resolution) {
super(gridRange, showGridLine, showPaginateLine, super(gridRange, showGridLine, showExtraGridLine, showPaginateLine,
paperPaintSize, paginateLineList, resolution); paperPaintSize, paginateLineList, resolution);
} }
@ -432,40 +455,47 @@ public class GridUI extends ComponentUI {
@Override @Override
protected void iterateStart2End(Graphics2D g2d) { protected void iterateStart2End(Graphics2D g2d) {
float columnWidth, paperXAxisSumSize = 0, xAxisSumSize = 0; UNIT columnWidth, paperXAxisSumSize = FU.getInstance(0), maxYAxisSumSize = FU.getInstance(0), xAxisSumSize = FU.getInstance(0);
for (int i = 0; i <= gridRange.xEndIndex; i++) { for (int i = 0; i <= gridRange.xEndIndex; i++) {
if (i == 0) { if (i == 0) {
i = gridRange.xBeginIndex; i = gridRange.xBeginIndex;
for (int k = 0; k < gridRange.xBeginIndex; k++) { for (int k = 0; k < gridRange.xBeginIndex; k++) {
columnWidth = gridRange.columnWidthList.get(k).toPixF(resolution); columnWidth = gridRange.columnWidthList.get(k);
paperXAxisSumSize += columnWidth; paperXAxisSumSize = paperXAxisSumSize.add(columnWidth);
if (paperXAxisSumSize >= paperPaintSize) { if (paperXAxisSumSize.toPixF(resolution) >= paperPaintSize) {
paperXAxisSumSize = columnWidth; paperXAxisSumSize = columnWidth;
} }
} }
} }
columnWidth = gridRange.columnWidthList.get(i).toPixF(resolution); columnWidth = gridRange.columnWidthList.get(i);
paperXAxisSumSize += columnWidth; paperXAxisSumSize = paperXAxisSumSize.add(columnWidth);
if (showGridLine) { if (showGridLine) {
float rowHeight, yAxisSumSize = 0; UNIT rowHeight, yAxisSumSize = FU.getInstance(0);
for (int j = gridRange.yBeginIndex; j <= gridRange.yEndIndex; j++) { for (int j = gridRange.yBeginIndex; j <= gridRange.yEndIndex; j++) {
rowHeight = gridRange.rowHeightList.get(j).toPixF(resolution); rowHeight = gridRange.rowHeightList.get(j);
if (!mergeCellElementTable.get(CellPosition.value(j, i - 1)).contains(CellPosition.RIGHT)) { if (!mergeCellElementTable.get(CellPosition.value(j, i - 1)).contains(CellPosition.RIGHT)) {
tmpLine2D.setLine(xAxisSumSize, yAxisSumSize, xAxisSumSize, yAxisSumSize + rowHeight); tmpLine2D.setLine(xAxisSumSize.toPixF(resolution), yAxisSumSize.toPixF(resolution), xAxisSumSize.toPixF(resolution), yAxisSumSize.add(rowHeight).toPixF(resolution));
g2d.draw(tmpLine2D); g2d.draw(tmpLine2D);
} }
yAxisSumSize += rowHeight; yAxisSumSize = yAxisSumSize.add(rowHeight);
}
if (yAxisSumSize.toPixF(resolution) > maxYAxisSumSize.toPixF(resolution)) {
maxYAxisSumSize = yAxisSumSize;
} }
} }
if (showPaginateLine && paperXAxisSumSize - paperPaintSize > THRESHOLD) { if (showPaginateLine && paperXAxisSumSize.toPixF(resolution) - paperPaintSize > THRESHOLD) {
paginateLineList.add(getPaginateLine2D((int) xAxisSumSize)); paginateLineList.add(getPaginateLine2D((int) xAxisSumSize.toPixF(resolution)));
paperXAxisSumSize = columnWidth; paperXAxisSumSize = columnWidth;
} }
xAxisSumSize += columnWidth; xAxisSumSize = xAxisSumSize.add(columnWidth);
} }
// paint 最后一个横线.. // paint 最后一个横线..
if (showGridLine) { if (showGridLine) {
drawLastLine(g2d, (int) xAxisSumSize); if (showExtraGridLine) {
drawLastLine(g2d, (int) xAxisSumSize.toPixD(resolution));
} else {
GraphHelper.drawLine(g2d, xAxisSumSize.toPixF(resolution), 0, xAxisSumSize.toPixF(resolution), maxYAxisSumSize.toPixF(resolution));
}
} }
} }
} }

Loading…
Cancel
Save