Browse Source

Merge branch 'release/10.0' of https://code.fineres.com/scm/~lucian.chen/design into release/10.0

security/10.0
lucian 3 years ago
parent
commit
b7e3055ce0
  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. 44
      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. 57
      designer-base/src/main/java/com/fr/design/data/datapane/connect/ItemEditableComboBoxPanel.java
  9. 5
      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. 2
      designer-base/src/main/java/com/fr/design/gui/controlpane/UIControlPane.java
  12. 3
      designer-base/src/main/java/com/fr/design/gui/ifilechooser/JavaFxNativeFileChooser.java
  13. 23
      designer-base/src/main/java/com/fr/design/gui/ilist/JNameEdList.java
  14. 15
      designer-base/src/main/java/com/fr/design/gui/itextfield/EditTextField.java
  15. 4
      designer-base/src/main/java/com/fr/design/javascript/ExportJavaScriptPane.java
  16. 11
      designer-base/src/main/java/com/fr/design/login/AbstractDesignerSSO.java
  17. 11
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java
  18. 6
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java
  19. 3
      designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java
  20. 4
      designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogMessageBar.java
  21. 11
      designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java
  22. 3
      designer-base/src/main/java/com/fr/design/roleAuthority/RolesEditedSourceOP.java
  23. 37
      designer-base/src/main/java/com/fr/design/ui/ModernUIPane.java
  24. 2
      designer-base/src/main/java/com/fr/design/ui/compatible/BuilderDiff.java
  25. 19
      designer-base/src/main/java/com/fr/design/ui/compatible/ModernUIPaneFactory.java
  26. 53
      designer-base/src/main/java/com/fr/design/ui/compatible/NewModernUIPane.java
  27. 13
      designer-base/src/main/java/com/fr/design/utils/DesignUtils.java
  28. 46
      designer-base/src/main/java/com/fr/design/utils/gui/AdjustWorkBookDefaultStyleUtils.java
  29. 8
      designer-base/src/main/java/com/fr/design/utils/gui/GUICoreUtils.java
  30. 12
      designer-base/src/main/java/com/fr/file/FILEChooserPane.java
  31. 1
      designer-base/src/main/resources/com/fr/design/i18n/dimension_en.properties
  32. 1
      designer-base/src/main/resources/com/fr/design/i18n/dimension_ja_JP.properties
  33. 1
      designer-base/src/main/resources/com/fr/design/i18n/dimension_ko_KR.properties
  34. 1
      designer-base/src/main/resources/com/fr/design/i18n/dimension_zh.properties
  35. 1
      designer-base/src/main/resources/com/fr/design/i18n/dimension_zh_TW.properties
  36. 7
      designer-base/src/test/java/com/fr/design/utils/DesignUtilsTest.java
  37. 10
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypePane.java
  38. 28
      designer-chart/src/main/java/com/fr/design/module/ChartHyperlinkGroup.java
  39. 41
      designer-chart/src/main/java/com/fr/design/module/ChartPreStyleListPane.java
  40. 3
      designer-chart/src/main/java/com/fr/van/chart/custom/other/VanChartCustomInteractivePane.java
  41. 5
      designer-chart/src/main/java/com/fr/van/chart/designer/other/VanChartInteractivePane.java
  42. 3
      designer-chart/src/main/java/com/fr/van/chart/map/designer/other/VanChartMapInteractivePane.java
  43. 56
      designer-form/src/main/java/com/fr/design/designer/creator/XBorderStyleWidgetCreator.java
  44. 13
      designer-form/src/main/java/com/fr/design/designer/creator/XChartEditor.java
  45. 20
      designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java
  46. 17
      designer-form/src/main/java/com/fr/design/designer/creator/XElementCase.java
  47. 6
      designer-form/src/main/java/com/fr/design/designer/creator/XLayoutContainer.java
  48. 8
      designer-form/src/main/java/com/fr/design/designer/creator/XWAbsoluteBodyLayout.java
  49. 2
      designer-form/src/main/java/com/fr/design/designer/creator/XWAbsoluteLayout.java
  50. 5
      designer-form/src/main/java/com/fr/design/designer/creator/XWParameterLayout.java
  51. 2
      designer-form/src/main/java/com/fr/design/designer/creator/XWTitleLayout.java
  52. 10
      designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardLayout.java
  53. 2
      designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardMainBorderLayout.java
  54. 8
      designer-form/src/main/java/com/fr/design/mainframe/EditingMouseListener.java
  55. 21
      designer-form/src/main/java/com/fr/design/mainframe/FormSelection.java
  56. 5
      designer-form/src/main/java/com/fr/design/mainframe/share/action/InstallComponentAction.java
  57. 11
      designer-form/src/main/java/com/fr/design/mainframe/share/util/InstallUtils.java
  58. 8
      designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRAbsoluteBodyLayoutDefinePane.java
  59. 14
      designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRFitLayoutDefinePane.java
  60. 6
      designer-realize/src/main/java/com/fr/design/actions/insert/flot/FormulaFloatAction.java
  61. 5
      designer-realize/src/main/java/com/fr/design/actions/insert/flot/TextBoxFloatAction.java
  62. 5
      designer-realize/src/main/java/com/fr/design/javascript/ListenerEditPane.java
  63. 2
      designer-realize/src/main/java/com/fr/design/mainframe/CellWidgetPropertyPane.java
  64. 5
      designer-realize/src/main/java/com/fr/design/mainframe/app/FormApp.java
  65. 16
      designer-realize/src/main/java/com/fr/design/mainframe/cell/CellElementEditPane.java
  66. 3
      designer-realize/src/main/java/com/fr/design/mainframe/form/FormElementCaseDesigner.java
  67. 8
      designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java
  68. 2
      designer-realize/src/main/java/com/fr/design/present/ConditionAttributesGroupPane.java
  69. 20
      designer-realize/src/main/java/com/fr/design/webattr/EditToolBar.java
  70. 3
      designer-realize/src/main/java/com/fr/design/webattr/WebCssPane.java
  71. 5
      designer-realize/src/main/java/com/fr/design/webattr/WebJsPane.java
  72. 14
      designer-realize/src/main/java/com/fr/design/widget/WidgetEventPane.java
  73. 20
      designer-realize/src/main/java/com/fr/grid/AbstractGridHeaderMouseHandler.java
  74. 13
      designer-realize/src/main/java/com/fr/grid/Grid.java
  75. 109
      designer-realize/src/main/java/com/fr/grid/GridUI.java
  76. 3
      designer-realize/src/main/java/com/fr/grid/dnd/ElementCasePaneDropTarget.java
  77. 1
      designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceActivator.java

2
build.gradle

@ -68,7 +68,7 @@ allprojects {
implementation 'org.swingexplorer:swexpl:2.0.1'
implementation 'org.swingexplorer:swag:1.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 'com.fr.third:fine-third:' + frVersion
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);
if (!envHome.exists()) {
StableUtils.mkdirs(envHome);
}
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;
import com.fr.design.i18n.Toolkit;
import com.fr.design.login.AbstractDesignerSSO;
import com.fr.design.menu.MenuKeySet;
import com.fr.general.CloudCenter;
@ -27,7 +28,11 @@ public class TutorialAction extends AbstractDesignerSSO {
@Override
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

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

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

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

44
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.ilable.UILabel;
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.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
@ -39,7 +40,16 @@ import com.fr.stable.StringUtils;
import com.fr.workspace.WorkContext;
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.ChangeListener;
import javax.swing.event.PopupMenuEvent;
@ -50,7 +60,6 @@ import javax.swing.tree.DefaultTreeModel;
import javax.swing.tree.TreeCellRenderer;
import javax.swing.tree.TreeNode;
import javax.swing.tree.TreePath;
import java.awt.*;
import java.awt.event.FocusAdapter;
import java.awt.event.FocusEvent;
import java.awt.event.ItemEvent;
@ -70,6 +79,9 @@ import java.util.concurrent.FutureTask;
* @since 2012-7-11下午4:49:39
*/
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;
/**
@ -91,6 +103,8 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
private SwingWorker populateWorker;
private SwingWorker<List<String>, Void> initWorker;
private PopupMenuListener popupMenuListener = new PopupMenuListener() {
@Override
@ -213,10 +227,34 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
@SuppressWarnings("unchecked")
protected void initDsNameComboBox() {
if (initWorker != null && !initWorker.isDone()) {
initWorker.cancel(true);
}
dsNameComboBox.setRefreshingModel(true);
FilterableComboBoxModel dsNameComboBoxModel = new FilterableComboBoxModel(getHasAuthConnections());
dsNameComboBox.setModel(new FilterableComboBoxModel(PENDING_CONTENT));
initWorker = new SwingWorker<List<String>, Void>() {
@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) {

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
*/
protected Iterator<String> items() {
nameList = new ArrayList<String>();
ConnectionConfig mgr = ConnectionConfig.getInstance();
Iterator<String> nameIt = mgr.getConnections().keySet().iterator();
Collection<String> noAuthConnections = WorkContext.getCurrent().get(DBConnectAuth.class).getNoAuthConnections();
nameList = new ArrayList<>();
if (noAuthConnections == null) {
return nameList.iterator();
}

57
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.design.gui.ibutton.UIButton;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import javax.swing.*;
import java.awt.*;
import com.fr.log.FineLoggerFactory;
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.ActionListener;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JPanel;
import javax.swing.SwingWorker;
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 String PENDING = Toolkit.i18nText("Fine-Design_Basic_Loading") + "...";
protected static final Object EMPTY = new Object() {
public String toString() {
return "";
@ -26,6 +35,8 @@ public abstract class ItemEditableComboBoxPanel extends JPanel {
protected UIButton editButton;
protected UIButton refreshButton;
private SwingWorker<Iterator<String>, Void> refreshWorker;
public ItemEditableComboBoxPanel() {
super();
@ -75,6 +86,11 @@ public abstract class ItemEditableComboBoxPanel extends JPanel {
* 刷新itemComboBox的内容
*/
protected void refreshItems() {
if (refreshWorker != null && !refreshWorker.isDone()) {
refreshWorker.cancel(true);
}
// 记录原来选中的Item,重新加载后需要再次选中
Object lastSelectedItem = itemComboBox.getSelectedItem();
@ -83,18 +99,43 @@ public abstract class ItemEditableComboBoxPanel extends JPanel {
// 先加EMPTY,再加items
model.addElement(EMPTY);
model.addElement(PENDING);
// 存在两种场景之前只考虑了填充场景 有populate会填充下 把这边的填充逻辑删了 所以没有问题
// 如果是纯通过刷新按钮 没有populate 需要手动设置下上次选中的内容
if (lastSelectedItem != null) {
model.setSelectedItem(lastSelectedItem);
}
java.util.Iterator<String> itemIt = items();
refreshWorker = new SwingWorker<Iterator<String>, Void>() {
@Override
protected Iterator<String> doInBackground() throws Exception {
return items();
}
@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);
}
}
// 再次选中之前选中的Item
int idx = model.getIndexOf(lastSelectedItem);
if(idx < 0) {
idx = 0;
}
itemComboBox.setSelectedIndex(idx);
};
refreshWorker.execute();
}
/*

5
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.design.DesignerEnvManager;
import com.fr.design.base.mode.DesignModeContext;
import com.fr.design.base.mode.DesignerMode;
import com.fr.design.data.DesignTableDataManager;
import com.fr.design.file.filter.ClassFilter;
import com.fr.design.i18n.Toolkit;
@ -69,7 +70,7 @@ public class HistoryTemplateListCache implements CallbackEvent {
DesignTableDataManager.closeTemplate(selected);
//直接关闭模板的时候(当且仅当设计器tab上只剩一个模板)退出权限编辑
if (DesignModeContext.isAuthorityEditing() && historyList.size() <= 1) {
DesignerContext.getDesignerFrame().closeAuthorityEditing();
DesignModeContext.switchTo(DesignerMode.NORMAL);
}
if (contains(selected) == -1) {
return;
@ -436,7 +437,7 @@ public class HistoryTemplateListCache implements CallbackEvent {
/**
* 重绘当前模板
*/
public void repaintCurrentEditingTemplate(){
public void repaintCurrentEditingTemplate() {
UIUtil.invokeLaterIfNeeded(new Runnable() {
@Override
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.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import java.util.Collection;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.util.Collection;
public abstract class JListControlPane extends JControlPane implements ListControlPaneProvider {
private static final String LIST_NAME = "JControl_List";
@ -335,7 +335,7 @@ public abstract class JListControlPane extends JControlPane implements ListContr
getHelper().checkButtonEnabled();
}
private class NameableListCellRenderer extends
protected class NameableListCellRenderer extends
DefaultListCellRenderer {
@Override
public Component getListCellRendererComponent(JList list, Object value,

2
designer-base/src/main/java/com/fr/design/gui/controlpane/UIControlPane.java

@ -387,8 +387,6 @@ public abstract class UIControlPane extends JControlPane {
contentPane.setBackground(originColor);
contentPane.setLayout(new BorderLayout());
titleLabel = new UILabel(title);
Font font = new Font("SimSun", Font.PLAIN, 12);
titleLabel.setFont(font);
contentPane.add(titleLabel, BorderLayout.WEST);
contentPane.setBorder(new EmptyBorder(5, 14, 6, 0));

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();
}
Stage stage = showCoverStage(fileChooserParent);
if (stage != null) {
stage.setAlwaysOnTop(true);
}
try {
if (fileSelectionMode == FileSelectionMode.FILE || fileSelectionMode == FileSelectionMode.MULTIPLE_FILE) {
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;
import com.fr.design.gui.NameInspector;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.general.GeneralUtils;
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.StringUtils;
import com.fr.stable.core.PropertyChangeAdapter;
import javax.swing.*;
import javax.swing.ListModel;
import javax.swing.event.CellEditorListener;
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.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 {
private static final int ICON_WIDTH = 20;
@ -38,6 +35,8 @@ public class JNameEdList extends UIList implements CellEditorListener {
*/
private String oldName;
private boolean replaceEmptyName = true;
public JNameEdList(ListModel dataModel) {
super(dataModel);
}
@ -70,6 +69,10 @@ public class JNameEdList extends UIList implements CellEditorListener {
return this.editable;
}
public void setReplaceEmptyName(boolean replaceEmptyName) {
this.replaceEmptyName = replaceEmptyName;
}
public void setNameShouldNumber(boolean isNameShouldNumber) {
this.isNameShouldNumber = isNameShouldNumber;
}
@ -301,7 +304,7 @@ public class JNameEdList extends UIList implements CellEditorListener {
ListCellEditor editor = getCellEditor();
if (editor != null && editorComp != null) {
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);
removeComp();
doAfterStopEditing();

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

@ -1,18 +1,20 @@
package com.fr.design.gui.itextfield;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Toolkit;
import javax.swing.text.AttributeSet;
import javax.swing.text.BadLocationException;
import javax.swing.text.PlainDocument;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Toolkit;
/**
* Number Field.
*/
public class EditTextField extends UIGridTextField {
private static final String I18NProperty = "i18n";
private int maxLength = 24;
public EditTextField() {
@ -39,7 +41,11 @@ public class EditTextField extends UIGridTextField {
}
class TextDocument extends PlainDocument {
private Object defaultI18NProperty;
public TextDocument() {
defaultI18NProperty = getProperty(I18NProperty);
}
@Override
@ -49,6 +55,7 @@ public class EditTextField extends UIGridTextField {
Toolkit.getDefaultToolkit().beep();
return;
}
putProperty(I18NProperty, defaultI18NProperty);
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.Parameter;
import com.fr.base.extension.FileExtension;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.DialogActionAdapter;
@ -417,6 +418,9 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript
if (path == 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.os.impl.SupportOSImpl;
import com.fr.design.utils.BrowseUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils;
import java.awt.event.ActionEvent;
import java.util.HashMap;
import java.util.Map;
@ -21,6 +24,10 @@ public abstract class AbstractDesignerSSO extends UpdateAction {
public void actionPerformed(ActionEvent event) {
String url = getJumpUrl();
if (!DesignerLoginUtils.isOnline()) {
String message = getOffLineWarnMessage();
if (StringUtils.isNotEmpty(message)) {
FineLoggerFactory.getLogger().warn(message);
}
BrowseUtils.browser(url);
return;
}
@ -47,4 +54,8 @@ public abstract class AbstractDesignerSSO extends UpdateAction {
}
public abstract String getJumpUrl();
public String getOffLineWarnMessage() {
return StringUtils.EMPTY;
}
}

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

6
designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java

@ -3,6 +3,7 @@ package com.fr.design.mainframe;
import com.fr.base.BaseUtils;
import com.fr.base.extension.FileExtension;
import com.fr.base.vcs.DesignerMode;
import com.fr.chartx.TwoTuple;
import com.fr.design.DesignModelAdapter;
import com.fr.design.DesignerEnvManager;
import com.fr.design.ExtraDesignClassManager;
@ -35,6 +36,8 @@ import com.fr.design.menu.ToolBarDef;
import com.fr.design.roleAuthority.RolesAlreadyEditedPane;
import com.fr.design.utils.DesignUtils;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.event.Event;
import com.fr.event.EventDispatcher;
import com.fr.file.FileNodeFILE;
import com.fr.file.filetree.FileNode;
import com.fr.general.ComparatorUtils;
@ -78,6 +81,8 @@ import java.util.Set;
import static javax.swing.JOptionPane.WARNING_MESSAGE;
public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarStateChangeListener, ResponseDataSourceChange {
public static final Event<TwoTuple<String, String>> TEMPLATE_RENAME = new Event<TwoTuple<String, String>>() {
};
private static final String FILE = "file";
private static volatile DesignerFrameFileDealerPane THIS;
@ -690,6 +695,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
boolean success = selectedOperation.rename(fnf, path, newPath);
if (success) {
EventDispatcher.fire(TEMPLATE_RENAME, new TwoTuple<>(path, newPath));
HistoryTemplateListCache.getInstance().rename(fnf, path, newPath);
DesignerEnvManager.getEnvManager().replaceRecentOpenedFilePath(fnf.isDirectory(), path, newPath);
selectedOperation.refresh();

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.preview.PagePreview;
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.EmptyCallBackSaveWorker;
import com.fr.design.write.submit.DBManipulationInWidgetEventPane;
@ -1071,7 +1072,7 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
public boolean isOldDesigner() {
String xmlDesignerVersion = getTarget().getXMLDesignerVersion();
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");
new InformationWarnPane(infor, moreInfo, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tool_Tips")).show();
return true;

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

@ -88,4 +88,8 @@ public class LogMessageBar extends JPanel {
}
THIS = null;
}
public JFrame getLogFrame() {
return dlg;
}
}

11
designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java

@ -40,6 +40,7 @@ import com.fr.design.actions.server.GlobalParameterAction;
import com.fr.design.actions.server.GlobalTableDataAction;
import com.fr.design.actions.server.PlatformManagerAction;
import com.fr.design.actions.server.PluginManagerAction;
import com.fr.design.base.mode.DesignModeContext;
import com.fr.design.file.NewTemplatePane;
import com.fr.design.fun.MenuHandler;
import com.fr.design.fun.OemProcessor;
@ -491,10 +492,12 @@ public abstract class ToolBarMenuDock {
if (!DesignerMode.isAuthorityEditing()) {
addPluginManagerAction(menuDef);
menuDef.addShortCut(
new FunctionManagerAction(),
new GlobalParameterAction()
);
menuDef.addShortCut(new FunctionManagerAction());
if (!DesignModeContext.isDuchampMode()) {
menuDef.addShortCut(new GlobalParameterAction());
}
}

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

@ -26,13 +26,14 @@ public class RolesEditedSourceOP extends RoleSourceOP {
RoleDataWrapper t = entry.getValue();
JTemplate jt = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
if (jt.getTarget() instanceof PrivilegeEditedRoleProvider) {
PrivilegeEditedRoleProvider pe = (PrivilegeEditedRoleProvider) jt.getTarget();
ExpandMutableTreeNode[] expand = t.load(Arrays.asList(pe.getAllEditedRoleSet()));
for (ExpandMutableTreeNode expandMutableTreeNode : expand) {
roleList.add(expandMutableTreeNode);
}
}
}
return roleList.toArray(new ExpandMutableTreeNode[roleList.size()]);
}
}

37
designer-base/src/main/java/com/fr/design/ui/ModernUIPane.java

@ -17,15 +17,16 @@ import com.teamdev.jxbrowser.chromium.events.ScriptContextAdapter;
import com.teamdev.jxbrowser.chromium.events.ScriptContextEvent;
import com.teamdev.jxbrowser.chromium.events.ScriptContextListener;
import com.teamdev.jxbrowser.chromium.swing.BrowserView;
import com.teamdev.jxbrowser.event.Observer;
import javax.swing.JDialog;
import javax.swing.SwingUtilities;
import javax.swing.WindowConstants;
import java.util.Map;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Map;
/**
* @author richie
@ -157,6 +158,34 @@ public class ModernUIPane<T> extends BasicPane {
return null;
}
public void disposeBrowser() {
if(browser != null) {
browser.dispose();
browser = null;
}
}
public void clearCache() {
if (browser != null) {
browser.getCacheStorage().clearCache();
}
}
public void executeJavaScript(String javaScript) {
if (browser != null) {
browser.executeJavaScript(javaScript);
}
}
public JSValue executeJavaScriptAndReturnValue(String javaScript) {
if (browser != null) {
return browser.executeJavaScriptAndReturnValue(javaScript);
}
return null;
}
public static class Builder<T> implements BuilderDiff<T> {
private ModernUIPane<T> pane;
@ -293,6 +322,12 @@ public class ModernUIPane<T> extends BasicPane {
return this;
}
@Override
public Builder<T> prepareForV7(Class event, Observer listener) {
// do nothing
return this;
}
public ModernUIPane<T> build() {
return pane;
}

2
designer-base/src/main/java/com/fr/design/ui/compatible/BuilderDiff.java

@ -4,6 +4,7 @@ import com.fr.design.ui.ModernUIPane;
import com.teamdev.jxbrowser.browser.callback.InjectJsCallback;
import com.teamdev.jxbrowser.chromium.events.LoadListener;
import com.teamdev.jxbrowser.chromium.events.ScriptContextListener;
import com.teamdev.jxbrowser.event.Observer;
/**
* 封装jxbrwoser v6/v7的构建方式的差异
@ -20,5 +21,6 @@ public interface BuilderDiff<T> {
ModernUIPane.Builder<T> prepareForV7(InjectJsCallback callback);
ModernUIPane.Builder<T> prepareForV7(Class event, Observer listener);
}

19
designer-base/src/main/java/com/fr/design/ui/compatible/ModernUIPaneFactory.java

@ -11,6 +11,17 @@ import com.fr.stable.os.OperatingSystem;
public class ModernUIPaneFactory {
public static <T> ModernUIPane.Builder<T> modernUIPaneBuilder() {
if (isV7()) {
return new NewModernUIPane.Builder<>();
} else {
return new ModernUIPane.Builder<>();
}
}
public static boolean isV7() {
// 7.15的class不存在时 走老版本
boolean hasJxBrowserV7_15 = true;
try {
@ -18,10 +29,8 @@ public class ModernUIPaneFactory {
} catch (ClassNotFoundException e) {
hasJxBrowserV7_15 = false;
}
if (OperatingSystem.isWindows() && hasJxBrowserV7_15) {
return new NewModernUIPane.Builder<>();
} else {
return new ModernUIPane.Builder<>();
}
return OperatingSystem.isWindows() && hasJxBrowserV7_15;
}
}

53
designer-base/src/main/java/com/fr/design/ui/compatible/NewModernUIPane.java

@ -15,6 +15,7 @@ import com.teamdev.jxbrowser.chromium.events.ScriptContextListener;
import com.teamdev.jxbrowser.engine.Engine;
import com.teamdev.jxbrowser.engine.EngineOptions;
import com.teamdev.jxbrowser.engine.RenderingMode;
import com.teamdev.jxbrowser.event.Observer;
import com.teamdev.jxbrowser.js.JsObject;
import com.teamdev.jxbrowser.net.Scheme;
import com.teamdev.jxbrowser.view.swing.BrowserView;
@ -80,30 +81,33 @@ public class NewModernUIPane<T> extends ModernUIPane<T> {
private void showDebuggerDialog() {
JDialog dialog = new JDialog(SwingUtilities.getWindowAncestor(this));
Engine engine = Engine.newInstance(
EngineOptions.newBuilder(RenderingMode.HARDWARE_ACCELERATED)
.addSwitch("--disable-google-traffic")
.remoteDebuggingPort(9222).build());
Browser debugger = engine.newBrowser();
Browser debugger = browser.engine().newBrowser();
BrowserView debuggerView = BrowserView.newInstance(debugger);
dialog.add(debuggerView, BorderLayout.CENTER);
dialog.setSize(new Dimension(800, 400));
GUICoreUtils.centerWindow(dialog);
dialog.setVisible(true);
dialog.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
browser.devTools().remoteDebuggingUrl().ifPresent(url -> {
debugger.navigation().loadUrl(url);
});
}
private void initializeBrowser() {
EngineOptions options;
EngineOptions.Builder builder;
if (scheme != null && requestCallback != null) {
options = EngineOptions.newBuilder(RenderingMode.HARDWARE_ACCELERATED).addSwitch("--disable-google-traffic").addScheme(scheme, requestCallback).build();
builder = EngineOptions.newBuilder(RenderingMode.HARDWARE_ACCELERATED).addSwitch("--disable-google-traffic").addScheme(scheme, requestCallback);
} else {
options = EngineOptions.newBuilder(RenderingMode.HARDWARE_ACCELERATED).addSwitch("--disable-google-traffic").build();
builder = EngineOptions.newBuilder(RenderingMode.HARDWARE_ACCELERATED).addSwitch("--disable-google-traffic");
}
if (DesignerEnvManager.getEnvManager().isOpenDebug()) {
builder.remoteDebuggingPort(9222);
}
Engine engine = Engine.newInstance(options);
Engine engine = Engine.newInstance(builder.build());
browser = engine.newBrowser();
// 初始化的时候,就把命名空间对象初始化好,确保window.a.b.c("a.b.c"为命名空间)对象都是初始化过的
@ -161,6 +165,29 @@ public class NewModernUIPane<T> extends ModernUIPane<T> {
return null;
}
public void disposeBrowser() {
if (browser != null) {
browser.close();
browser = null;
}
}
public void clearCache() {
if (browser != null) {
browser.engine().httpCache().clear();
}
}
public void executeJavaScript(String javaScript) {
if (browser != null) {
browser.mainFrame().ifPresent(frame -> {
frame.executeJavaScript(javaScript);
});
}
}
public static class Builder<T> extends ModernUIPane.Builder<T> {
private NewModernUIPane<T> pane = new NewModernUIPane<>();
@ -301,6 +328,14 @@ public class NewModernUIPane<T> extends ModernUIPane<T> {
return prepare(callback);
}
@Override
public ModernUIPane.Builder<T> prepareForV7(Class event, Observer listener) {
pane.browser.navigation().on(event, listener);
return this;
}
@Override
public NewModernUIPane<T> build() {
return pane;

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

@ -425,4 +425,17 @@ public class DesignUtils {
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;
}
}

46
designer-base/src/main/java/com/fr/design/utils/gui/AdjustWorkBookDefaultStyleUtils.java

@ -0,0 +1,46 @@
package com.fr.design.utils.gui;
import com.fr.base.Style;
import com.fr.base.background.ColorBackground;
import com.fr.design.base.mode.DesignModeContext;
import com.fr.report.cell.CellElement;
import com.fr.report.cell.FloatElement;
import java.awt.Color;
/**
* @author shine
* @version 10.0
* Created by shine on 2021/9/6
*/
public class AdjustWorkBookDefaultStyleUtils {
private static final Color TEMPLATE_BACKGROUND = new Color(16, 11, 43);
private static final Color CELL_ELEMENT_BORDER = new Color(110, 110, 110);
public static void adjustCellElement(CellElement cellElement) {
if (DesignModeContext.isDuchampMode()) {
Style style = cellElement.getStyle();
style = style.deriveFRFont(style.getFRFont().applyForeground(Color.WHITE));
style = style.deriveBorder(0, CELL_ELEMENT_BORDER,
0, CELL_ELEMENT_BORDER,
0, CELL_ELEMENT_BORDER,
0, CELL_ELEMENT_BORDER);
cellElement.setStyle(style);
}
}
public static void adjustFloatElement(FloatElement floatElement) {
if (DesignModeContext.isDuchampMode()) {
Style style = floatElement.getStyle();
style = style.deriveBackground(ColorBackground.getInstance(TEMPLATE_BACKGROUND));
style = style.deriveFRFont(style.getFRFont().applyForeground(Color.WHITE));
floatElement.setStyle(style);
}
}
public static Color adjustBack(Color color) {
return DesignModeContext.isDuchampMode() ? TEMPLATE_BACKGROUND : color;
}
}

8
designer-base/src/main/java/com/fr/design/utils/gui/GUICoreUtils.java

@ -38,7 +38,6 @@ import com.fr.stable.Constants;
import com.fr.stable.OperatingSystem;
import com.fr.stable.StringUtils;
import java.awt.Container;
import javax.swing.AbstractButton;
import javax.swing.Action;
import javax.swing.BorderFactory;
@ -67,10 +66,13 @@ import javax.swing.tree.TreePath;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Container;
import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
import java.awt.GridLayout;
import java.awt.Image;
import java.awt.Point;
@ -82,8 +84,6 @@ import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.awt.image.BufferedImage;
import java.awt.image.ImageObserver;
import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@ -176,7 +176,7 @@ public final class GUICoreUtils {
if (style.getBackground() instanceof ColorBackground) {
textField.setBackground(((ColorBackground) style.getBackground()).getColor());
} else {
textField.setBackground(Color.WHITE);
textField.setBackground(AdjustWorkBookDefaultStyleUtils.adjustBack(Color.WHITE));
}
}

12
designer-base/src/main/java/com/fr/file/FILEChooserPane.java

@ -29,6 +29,9 @@ import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.DesignerFrame;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.event.Event;
import com.fr.event.EventDispatcher;
import com.fr.event.Listener;
import com.fr.file.filetree.FileNode;
import com.fr.file.filter.ChooseFileFilter;
import com.fr.file.filter.FILEFilter;
@ -45,6 +48,8 @@ import com.fr.stable.os.windows.WindowsDetector;
import com.fr.stable.project.ProjectConstants;
import com.fr.workspace.WorkContext;
import com.fr.workspace.Workspace;
import com.fr.workspace.WorkspaceEvent;
import javax.swing.AbstractAction;
import javax.swing.AbstractListModel;
import javax.swing.ActionMap;
@ -66,7 +71,6 @@ import javax.swing.ListModel;
import javax.swing.ListSelectionModel;
import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import javax.swing.event.ListSelectionEvent;
@ -1325,6 +1329,12 @@ public class FILEChooserPane extends BasicPane {
LocationButtonPane.this.repaint(10);
}
});
EventDispatcher.listen(WorkspaceEvent.AfterSwitch, new Listener<Workspace>() {
@Override
public void on(Event event, Workspace param) {
setPopDir(null);
}
});
}
public void highLightButton(FILE dir) {

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.detail.label=750*30
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.detail.label=650*30
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.detail.label=700*30
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.detail.label=450*30
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.detail.label=450*30
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 junit.framework.TestCase;
import org.junit.Assert;
import org.junit.Test;
import java.net.ServerSocket;
@ -29,4 +30,10 @@ public class DesignUtilsTest extends TestCase {
assertTrue(DesignUtils.isPortOccupied());
}
@Test
public void testParseVersion() {
Assert.assertEquals("10", DesignUtils.parseVersion("KAA"));
Assert.assertEquals("11", DesignUtils.parseVersion("LAA"));
}
}

10
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypePane.java

@ -173,8 +173,7 @@ public class ChartTypePane extends AbstractChartAttrPane {
Map<Integer, Map<String, FurtherBasicBeanPane<? extends ChartProvider>>> allChartTypePane,
ActionListener autoButtonListener) {
String[] chartIDs = ChartTypeManager.getInstance().getAllChartIDs();
String[] chartIDs = ChartTypeManager.getInstance().getAllChartIDsIncludeDisabled();
for (String id : chartIDs) {
@ -222,6 +221,7 @@ public class ChartTypePane extends AbstractChartAttrPane {
String lastPlotID = chart.getID();
boolean chartTypeChange = false;
try {
AbstractChartTypePane selectedPane = (AbstractChartTypePane) getSelectedPane();
ChartProvider newDefaultChart = (ChartProvider) ChartTypeManager.getInstanceWithCheck().getCharts(selectedPane.getPlotID())[0].clone();
@ -231,13 +231,16 @@ public class ChartTypePane extends AbstractChartAttrPane {
editingCollection.removeNameObject(editingCollection.getSelectedIndex());
editingCollection.addChart(newDefaultChart);
chart = newDefaultChart;
chartTypeChange = true;
}
} catch (CloneNotSupportedException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
//这一步会替换plot
String id = chart.getID();
((AbstractChartTypePane) getSelectedPane()).updateBean(chart);
if (inForm) {
chartTypeChange = chartTypeChange || !ComparatorUtils.equals(id, chart.getID());
if (inForm && chartTypeChange) {
chart.resetAttrInForm();
}
reLayoutEditPane(chart, lastPlotID);
@ -465,5 +468,6 @@ public class ChartTypePane extends AbstractChartAttrPane {
public void registerChartEditPane(ChartEditPane currentEditPane) {
this.editPane = currentEditPane;
this.inForm = editPane.isInForm();
buttonPane.refreshChartInForm(inForm);
}
}

28
designer-chart/src/main/java/com/fr/design/module/ChartHyperlinkGroup.java

@ -58,21 +58,26 @@ public class ChartHyperlinkGroup extends BaseHyperlinkGroup {
if (template == null) {
return false;
}
if (template.isJWorkBook() || DesignModeContext.isDuchampMode()) {
// 如果是普通报表单元格,那么没有 FormHyperlink 选项
FormHyperlinkProvider formHyperlink = StableFactory.getMarkedInstanceObjectFromClass(FormHyperlinkProvider.XML_TAG, FormHyperlinkProvider.class);
//返回true表示可用,返回false表示不可用
return !ComparatorUtils.equals(clazz, formHyperlink.getClass());
} else {
// 如果是决策报表
Class[] classes = new Class[]{ChartHyperRelateCellLink.class, ChartHyperRelateFloatLink.class};
for (Class aClass : classes) {
if (template.getEditingReportIndex() == BaseJForm.FORM_TAB) {
// 编辑的是决策报表中的图表,那么没有ChartHyperRelateFloatLink 和 ChartHyperRelateCellLink 选项,有FormHyperlink 选项
Class[] classes = new Class[]{ChartHyperRelateCellLink.class, ChartHyperRelateFloatLink.class};
return !ArrayUtils.contains(classes, clazz);
if (ComparatorUtils.equals(aClass, clazz)) {
return false;
}
} else if (template.getEditingReportIndex() == BaseJForm.ELEMENTCASE_TAB) {
// 编辑的是决策报表中的报表块,那么没有 ChartHyperPoplink 和 ChartHyperRelateFloatLink
Class[] classes = new Class[]{ChartHyperPoplink.class, ChartHyperRelateFloatLink.class};
return !ArrayUtils.contains(classes, clazz);
// 编辑的是决策报表中的报表块,那么没有 ChartHyperRelateFloatLink,有ChartHyperRelateCellLink 和 FormHyperlink 选项
return !ComparatorUtils.equals(clazz, ChartHyperRelateFloatLink.class);
}
}
}
return true;
@ -96,14 +101,17 @@ public class ChartHyperlinkGroup extends BaseHyperlinkGroup {
return !ComparatorUtils.equals(object.getClass(), formHyperlink.getClass());
} else {
// 如果是决策报表
Class[] classes = new Class[]{ChartHyperRelateCellLink.class, ChartHyperRelateFloatLink.class};
for (Class aClass : classes) {
if (template.getEditingReportIndex() == BaseJForm.FORM_TAB) {
// 编辑的是决策报表中的图表,那么没有ChartHyperRelateFloatLink 和 ChartHyperRelateCellLink 选项,有FormHyperlink 选项
Class[] classes = new Class[]{ChartHyperRelateCellLink.class, ChartHyperRelateFloatLink.class};
return !ArrayUtils.contains(classes, object.getClass());
if (ComparatorUtils.equals(aClass, object.getClass())) {
return false;
}
} else if (template.getEditingReportIndex() == BaseJForm.ELEMENTCASE_TAB) {
// 编辑的是决策报表中的报表块,那么没有 ChartHyperPoplink 和 ChartHyperRelateFloatLink
Class[] classes = new Class[]{ChartHyperPoplink.class, ChartHyperRelateFloatLink.class};
return !ArrayUtils.contains(classes, object.getClass());
// 编辑的是决策报表中的报表块,那么没有 ChartHyperRelateFloatLink,有ChartHyperRelateCellLink 和 FormHyperlink 选项
return !ComparatorUtils.equals(object.getClass(), ChartHyperRelateFloatLink.class);
}
}
}
return true;

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.Utils;
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.NameObjectCreator;
import com.fr.design.gui.controlpane.NameableCreator;
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.i18n.Toolkit;
import com.fr.design.menu.ShortCut;
import com.fr.general.ComparatorUtils;
import com.fr.general.NameObject;
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.ListSelectionListener;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
/**
* @author Bjorn
@ -31,6 +40,38 @@ public class ChartPreStyleListPane extends JListControlPane {
super();
this.chartPreStyleManagerPane = chartPreStyleManagerPane;
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;
}
/**

3
designer-chart/src/main/java/com/fr/van/chart/custom/other/VanChartCustomInteractivePane.java

@ -44,6 +44,9 @@ public class VanChartCustomInteractivePane extends VanChartInteractivePane {
@Override
protected void updateHyperlink(Plot plot){
if (hyperlinkPane == null) {
return;
}
hyperlinkPane.updateBean(chart);
}

5
designer-chart/src/main/java/com/fr/van/chart/designer/other/VanChartInteractivePane.java

@ -685,8 +685,10 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane<Chart> {
}
protected void updateHyperlink(Plot plot) {
if (superLink != null) {
superLink.update(plot);
}
}
private void updateChartTools(VanChart chart) {
VanChartTools vanChartTools = new VanChartTools();
@ -734,6 +736,9 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane<Chart> {
private void updateAutoRefresh(VanChart chart) {
if (autoRefreshPane == null) {
return;
}
RefreshMoreLabel refreshMoreLabel = chart.getRefreshMoreLabel();
if (refreshMoreLabel == null) {

3
designer-chart/src/main/java/com/fr/van/chart/map/designer/other/VanChartMapInteractivePane.java

@ -35,6 +35,9 @@ public class VanChartMapInteractivePane extends VanChartInteractivePaneWithMapZo
@Override
protected void updateHyperlink(Plot plot) {
if (hyperlinkPane == null) {
return;
}
hyperlinkPane.updateBean(plot);
}

56
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.border.Border;
import javax.swing.border.LineBorder;
import javax.swing.plaf.PanelUI;
import javax.swing.plaf.basic.BasicPanelUI;
import java.awt.*;
import java.awt.geom.Rectangle2D;
import java.awt.geom.RoundRectangle2D;
@ -42,12 +44,23 @@ public class XBorderStyleWidgetCreator extends XWidgetCreator{
public XBorderStyleWidgetCreator(Widget widget, Dimension initSize) {
super(widget, initSize);
setUI(new NoBackgroundPaneUI());
setOpaque(false);
setBackupBound(null);
ExtendSharableAttrMark sharableAttrMark = this.toData().getWidgetAttrMark(ExtendSharableAttrMark.XML_TAG);
if (sharableAttrMark != null) {
this.setShareId(sharableAttrMark.getShareId());
}
}
@Override
public void setUI(PanelUI ui) {
if (ui instanceof NoBackgroundPaneUI) {
super.setUI(ui);
}
}
public Background getBackground4Painting() {
return this.background4Painting;
}
@ -88,12 +101,21 @@ public class XBorderStyleWidgetCreator extends XWidgetCreator{
super.addToWrapper(parentPanel, width, minHeight);
// REPORT-53175: 新创建的图表组件默认显示标题 since 10.0.18
// 将当前对象添加到父容器后,初始化默认样式的效果
initStyle();
refreshStylePreviewEffect();
}
/**
* @deprecated 该方法在样式数据模型发生变化如主题更新/body布局类型切换等均会被调用并不仅限于初始化
* 因此原方法名称废弃不应当被继续使用
* @link {{@link #refreshStylePreviewEffect()}}
*/
protected void initStyle() {
refreshStylePreviewEffect();
}
public void refreshStylePreviewEffect() {
BorderPacker style = toData().getBorderStyle();
initBorderAndBackgroundStyle();
refreshBorderAndBackgroundStylePreviewEffect();
if (ComparatorUtils.equals(style.getType(), LayoutBorderStyle.TITLE)) {
initTitleStyle(style);
} else {
@ -104,7 +126,16 @@ public class XBorderStyleWidgetCreator extends XWidgetCreator{
reshuffleBorderAndBackgroundPaintingEffectIfTitleExists();
}
/**
* @deprecated 该方法在样式数据模型发生变化如主题更新/图表默认开启标题等时均会被调用并不仅限于初始化
* 因此原方法名称废弃不应当被继续使用
* @link {{@link #refreshBorderAndBackgroundStylePreviewEffect()} ()}}
*/
protected void initBorderAndBackgroundStyle() {
refreshBorderAndBackgroundStylePreviewEffect();
}
public void refreshBorderAndBackgroundStylePreviewEffect() {
BorderPacker style = toData().getBorderStyle();
LineBorder DEFAULT_LINE_BORDER = (LineBorder) DEFALUTBORDER;
@ -263,6 +294,11 @@ public class XBorderStyleWidgetCreator extends XWidgetCreator{
}
@Override
public void setBackground(Color bg) {
super.setBackground(bg);
}
// 根据当前组件边框裁剪内容,如果当前组件存在圆角,则应当按圆角裁剪内容
private void clipByRoundedBorder(Graphics2D g2d) {
Border currentBorder = getBorder();
@ -280,6 +316,11 @@ public class XBorderStyleWidgetCreator extends XWidgetCreator{
// 设计器预览界面中绘制组件背景效果
public void paintBackground(Graphics2D g2d) {
if (isOpaque()) {
g2d.setColor(getBackground());
g2d.fillRect(0, 0, getWidth(), getHeight());
}
Background background4Painting = getBackground4Painting();
if (background4Painting != null) {
Composite oldComposite = g2d.getComposite();
@ -303,12 +344,12 @@ public class XBorderStyleWidgetCreator extends XWidgetCreator{
}
public void paintForeground(Graphics2D g2d) {
super.paint(g2d);
super.paintComponent(g2d);
super.paintBorder(g2d);
}
@Override
public void paint(Graphics g) {
public void paintComponent(Graphics g) {
this.clipByRoundedBorder((Graphics2D) g);
this.paintBackground((Graphics2D) g);
this.paintBorderImage((Graphics2D) g);
@ -370,4 +411,11 @@ public class XBorderStyleWidgetCreator extends XWidgetCreator{
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);
}
}
}

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

@ -122,7 +122,7 @@ public class XChartEditor extends XBorderStyleWidgetCreator {
@Override
public void propertyChange() {
initStyle();
refreshStylePreviewEffect();
}
}),
};
@ -165,7 +165,7 @@ public class XChartEditor extends XBorderStyleWidgetCreator {
@Override
protected void initXCreatorProperties() {
super.initXCreatorProperties();
initBorderAndBackgroundStyle();
refreshBorderAndBackgroundStylePreviewEffect();
BaseChartCollection collection = ((BaseChartEditor) data).getChartCollection();
isRefreshing = true;
((MiddleChartComponent) designerEditor.getEditorTarget()).populate(collection);
@ -232,7 +232,14 @@ public class XChartEditor extends XBorderStyleWidgetCreator {
Dimension size = getSize();
PaddingMargin margin = toData().getMargin();
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) {
int horizonMargin = margin != null ? margin.getLeft() + margin.getRight() : 0;
@ -334,7 +341,7 @@ public class XChartEditor extends XBorderStyleWidgetCreator {
* data属性改变触发其他操作
*/
public void firePropertyChange() {
initStyle();
refreshStylePreviewEffect();
}
@Override

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

@ -23,6 +23,7 @@ import com.fr.design.mainframe.EditingMouseListener;
import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.NoSupportAuthorityEdit;
import com.fr.design.mainframe.WidgetPropertyPane;
import com.fr.design.mainframe.loghandler.LogMessageBar;
import com.fr.design.plugin.DesignerPluginContext;
import com.fr.design.utils.gui.LayoutUtils;
import com.fr.form.ui.Widget;
@ -33,6 +34,7 @@ import com.fr.stable.StringUtils;
import javax.swing.BorderFactory;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
import javax.swing.border.Border;
@ -776,12 +778,16 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo
if (popup == null) {
popup = new SelectedPopupDialog(this, designer);
}
JFrame frame = LogMessageBar.getInstance().getLogFrame();
if (frame!= null && frame.isActive()) {
return;
}
int creatorRightX = (int) ((bounds.x + bounds.width + SelectedPopupDialog.OFFSET_X) * designer.getScale());
int creatorRightY = (int) (bounds.y * designer.getScale());
int formDesignerWidth = designer.getWidth();
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);
if (designer.isFormParaDesigner() && extraY + this.getHeight() >= formDesignerHeight) {
@ -793,10 +799,20 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
try {
popup.setLocation(designer.getLocationOnScreen().x + designer.getPaintX() + extraX, designer.getLocationOnScreen().y + designer.getPaintY() + extraY);
popup.updatePane(designer);
popup.setVisible(selected && accept && popup.hasVisibleButtons() && popup.isCanVisible() && !isShowPluginDialog());
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.util.Set;
public class XElementCase extends XBorderStyleWidgetCreator implements FormElementCaseContainerProvider , Releasable {
public class XElementCase extends XBorderStyleWidgetCreator implements FormElementCaseContainerProvider, Releasable {
private UILabel imageLable;
private FormDesigner designer;
private static BufferedImage DEFAULT_BACKGROUND;
@ -58,7 +58,7 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme
super.initXCreatorProperties();
// 报表块初始化时要加载对应的borderStyle
initBorderAndBackgroundStyle();
refreshBorderAndBackgroundStylePreviewEffect();
}
/**
@ -94,7 +94,7 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme
@Override
public void propertyChange() {
initStyle();
refreshStylePreviewEffect();
}
}),
new CRPropertyDescriptor("margin", this.data.getClass()).setEditorClass(PaddingMarginEditor.class)
@ -269,6 +269,12 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme
return toData().getElementCase();
}
@Override
public void doLayout() {
super.doLayout();
this.updateECImage();
}
public String getElementCaseContainerName() {
return toData().getWidgetName();
}
@ -321,9 +327,8 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme
FormDesigner designer = editingMouseListener.getDesigner();
if (e.getButton() == MouseEvent.BUTTON1 &&
(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() {
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
public void propertyChange() {
initStyle();
refreshStylePreviewEffect();
}
}),
new CRPropertyDescriptor("margin", this.data.getClass()).setEditorClass(PaddingMarginEditor.class)
@ -118,7 +118,7 @@ public abstract class XLayoutContainer extends XBorderStyleWidgetCreator impleme
@Override
protected void initXCreatorProperties() {
super.initXCreatorProperties();
initBorderAndBackgroundStyle();
refreshBorderAndBackgroundStylePreviewEffect();
this.initLayoutManager();
this.convert();
}
@ -547,7 +547,7 @@ public abstract class XLayoutContainer extends XBorderStyleWidgetCreator impleme
*
*/
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
public void propertyChange() {
initStyle();
XWAbsoluteBodyLayout.this.refreshStylePreviewEffect();
}
})
};
@ -105,8 +105,8 @@ public class XWAbsoluteBodyLayout extends XWAbsoluteLayout {
}
@Override
protected void initStyle() {
initBorderAndBackgroundStyle();
public void refreshStylePreviewEffect() {
refreshBorderAndBackgroundStylePreviewEffect();
}
/**
@ -114,7 +114,7 @@ public class XWAbsoluteBodyLayout extends XWAbsoluteLayout {
*
*/
public void firePropertyChange(){
initStyle();
this.refreshStylePreviewEffect();
}
@Override

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

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

5
designer-form/src/main/java/com/fr/design/designer/creator/XWParameterLayout.java

@ -108,11 +108,6 @@ public class XWParameterLayout extends XWAbsoluteLayout {
return false;
}
@Override
public boolean canEnterIntoAdaptPane() {
return false;
}
/**
* 该组件是否可以拖拽(表单中参数面板和自适应布局不可以拖拽)
* @return 是则返回true

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

@ -63,7 +63,7 @@ public class XWTitleLayout extends DedicateLayoutContainer {
}
@Override
protected void initBorderAndBackgroundStyle() {
public void refreshBorderAndBackgroundStylePreviewEffect() {
setBorder(null);
setBorderImage4Painting(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
protected XLayoutContainer getCreatorWrapper(String widgetName) {
initStyle();
refreshStylePreviewEffect();
Dimension dimension = new Dimension();
//主结构是一个borderlayout, 标签部分是north, card部分为center
WCardMainBorderLayout border = new WCardMainBorderLayout();
@ -389,7 +389,7 @@ public class XWCardLayout extends XLayoutContainer {
@Override
public void propertyChange() {
initStyle();
refreshStylePreviewEffect();
}
})
};
@ -397,10 +397,10 @@ public class XWCardLayout extends XLayoutContainer {
//初始化样式
@Override
protected void initStyle() {
public void refreshStylePreviewEffect() {
BorderPacker style = toData().getBorderStyle();
initBorderTitleStyle(style);
initBorderAndBackgroundStyle();
refreshBorderAndBackgroundStylePreviewEffect();
clearOrShowTitleLayout(ComparatorUtils.equals(style.getType(), LayoutBorderStyle.TITLE));
}
@ -484,7 +484,7 @@ public class XWCardLayout extends XLayoutContainer {
*/
@Override
public void firePropertyChange() {
initStyle();
refreshStylePreviewEffect();
}
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(){
XWCardLayout cardLayout = this.getCardPart();
if (cardLayout != null && cardLayout.toData() != null) {
cardLayout.initStyle();
cardLayout.refreshStylePreviewEffect();
}
}

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

@ -34,6 +34,7 @@ import com.fr.design.utils.ComponentUtils;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.design.utils.gui.LayoutUtils;
import com.fr.general.ComparatorUtils;
import com.fr.stable.ArrayUtils;
import com.fr.stable.Constants;
import javax.swing.BorderFactory;
@ -645,16 +646,15 @@ public class EditingMouseListener extends MouseInputAdapter {
selectionModel.selectACreatorAtMouseEvent(e);
refreshTopXCreator();
XCreator[] xCreators = selectionModel.getSelection().getSelectedCreators();
if (ArrayUtils.getLength(xCreators) == 1) {
// 放到事件队尾执行
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
for (XCreator xCreator : xCreators) {
xCreator.setSelected(!e.isShiftDown() && !e.isControlDown());
}
xCreators[0].setSelected(!e.isShiftDown() && !e.isControlDown());
}
});
}
} else if (clickedNonCardButton && uneditedTab && responseTabLayout(oldCreator, e)) {
// do nothing
} else {

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

@ -294,7 +294,6 @@ public class FormSelection {
creator.setBackupBound(backupBounds);
}
layoutAdapter.fix(creator);
resetElementCaseImage(creator);
}
i++;
}
@ -322,26 +321,6 @@ public class FormSelection {
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

5
designer-form/src/main/java/com/fr/design/mainframe/share/action/InstallComponentAction.java

@ -120,7 +120,7 @@ public class InstallComponentAction extends UpdateAction {
private boolean containRues(File[] chosenFiles) {
for (File file : chosenFiles) {
if (file.getName().endsWith(ReuxUtils.REUS_SUFFIX))
if (ReuxUtils.isReusFile(file))
return true;
}
return false;
@ -142,8 +142,7 @@ public class InstallComponentAction extends UpdateAction {
return false;
}
ShareComponentUtils.checkReadMe();
boolean isReus = chosenFile.getName().endsWith(ReuxUtils.REUS_SUFFIX);
return isReus ? InstallUtils.installReusFile(chosenFile, installTime, failList) : InstallUtils.installReuFile(chosenFile, installTime, failList);
return ReuxUtils.isReusFile(chosenFile) ? InstallUtils.installReusFile(chosenFile, installTime, failList) : InstallUtils.installReuFile(chosenFile, installTime, failList);
}
private static class InstallBackInfo {

11
designer-form/src/main/java/com/fr/design/mainframe/share/util/InstallUtils.java

@ -84,7 +84,7 @@ public class InstallUtils {
@Nullable
private static Group createComponentGroup(String fileName) {
String groupName = fileName.substring(0, fileName.indexOf(DOT + ReuxUtils.REUS_SUFFIX));
String groupName = createGroupName(fileName);
//有重名分组则加后缀
if (DefaultShareGroupManager.getInstance().getGroup(groupName) != null) {
@ -101,6 +101,15 @@ public class InstallUtils {
return DefaultShareGroupManager.getInstance().getGroup(groupName);
}
private static String createGroupName(String fileName) {
for (String suffix : ReuxUtils.SUPPORT_REUS_SUFFIX) {
if (fileName.endsWith(suffix)) {
return fileName.substring(0, fileName.indexOf(DOT + suffix));
}
}
return fileName;
}
private static boolean installReuFile(Group group, File chosenFile, long installTime) {
try {
if (!group.installModule(chosenFile)) {

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.WAbsoluteLayout;
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 javax.swing.BorderFactory;
@ -150,7 +152,13 @@ public class FRAbsoluteBodyLayoutDefinePane extends FRAbsoluteLayoutDefinePane {
if (state == WBodyLayoutType.FIT.getTypeValue()) {
XWFitLayout xwFitLayout = ((XWFitLayout)creator.getBackupParent());
xwFitLayout.switch2FitBodyLayout(creator);
WFitLayout wFitLayout = xwFitLayout.toData();
// 切换布局类型时,保留body背景样式
if (wFitLayout != null) {
wFitLayout.setBorderStyle(layout.getBorderStyle());
}
copyLayoutAttr(layout, xwFitLayout.toData());
xwFitLayout.refreshStylePreviewEffect();
}
}
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.WFitLayout;
import com.fr.general.ComparatorUtils;
import com.fr.general.act.BorderPacker;
import com.fr.log.FineLoggerFactory;
import com.fr.report.core.ReportUtils;
import javax.swing.*;
import javax.swing.border.Border;
import java.awt.*;
/**
@ -191,9 +193,12 @@ public class FRFitLayoutDefinePane extends AbstractFRLayoutDefinePane<WFitLayout
layout.setLayoutType(WBodyLayoutType.parse(state));
layout.setCompState(adaptComboBox.getSelectedIndex());
try {
// 自适应布局切换到绝对布局
if (state == WBodyLayoutType.ABSOLUTE.getTypeValue()) {
WAbsoluteBodyLayout wAbsoluteBodyLayout = new WAbsoluteBodyLayout("body");
wAbsoluteBodyLayout.setCompState(WAbsoluteLayout.STATE_FIXED);
// 切换布局类型时,保留body背景样式
wAbsoluteBodyLayout.setBorderStyle((BorderPacker) (layout.getBorderStyle().clone()));
Component[] components = xWFitLayout.getComponents();
xWFitLayout.removeAll();
layout.resetStyle();
@ -215,6 +220,15 @@ public class FRFitLayoutDefinePane extends AbstractFRLayoutDefinePane<WFitLayout
FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner();
formDesigner.getSelectionModel().setSelectedCreators(
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) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);

6
designer-realize/src/main/java/com/fr/design/actions/insert/flot/FormulaFloatAction.java

@ -5,7 +5,6 @@ package com.fr.design.actions.insert.flot;
import com.fr.base.BaseFormula;
import com.fr.base.DynamicUnitList;
import com.fr.design.actions.ElementCaseAction;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter;
@ -15,7 +14,7 @@ import com.fr.design.formula.UIFormula;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.menu.MenuKeySet;
import com.fr.design.utils.gui.AdjustWorkBookDefaultStyleUtils;
import com.fr.grid.Grid;
import com.fr.grid.selection.FloatSelection;
import com.fr.report.ReportHelper;
@ -23,7 +22,7 @@ import com.fr.report.cell.FloatElement;
import com.fr.report.elementcase.TemplateElementCase;
import com.fr.stable.unit.FU;
import javax.swing.*;
import javax.swing.KeyStroke;
/**
* Insert formula.
@ -100,6 +99,7 @@ public class FormulaFloatAction extends ElementCaseAction {
reportPane.stopEditing();
final FloatElement floatElement = new FloatElement();
AdjustWorkBookDefaultStyleUtils.adjustFloatElement(floatElement);
final UIFormula formulaPane = FormulaFactory.createFormulaPane();
formulaPane.populate(BaseFormula.createFormulaBuilder().build());

5
designer-realize/src/main/java/com/fr/design/actions/insert/flot/TextBoxFloatAction.java

@ -7,7 +7,7 @@ import com.fr.base.DynamicUnitList;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.menu.MenuKeySet;
import com.fr.design.utils.gui.AdjustWorkBookDefaultStyleUtils;
import com.fr.grid.Grid;
import com.fr.grid.selection.FloatSelection;
import com.fr.report.ReportHelper;
@ -15,7 +15,7 @@ import com.fr.report.cell.FloatElement;
import com.fr.report.elementcase.TemplateElementCase;
import com.fr.stable.unit.FU;
import javax.swing.*;
import javax.swing.KeyStroke;
import java.awt.event.ActionEvent;
/**
@ -60,6 +60,7 @@ public class TextBoxFloatAction extends AbstractShapeAction {
return;
}
FloatElement floatElement = new FloatElement("Text");
AdjustWorkBookDefaultStyleUtils.adjustFloatElement(floatElement);
this.startDraw(floatElement);
doWithDrawingFloatElement();
}

5
designer-realize/src/main/java/com/fr/design/javascript/ListenerEditPane.java

@ -182,7 +182,10 @@ public class ListenerEditPane extends BasicBeanPane<Listener> {
@Override
public Listener updateBean() {
String actionLocaleName = ReportEngineEventMapping.getLocaleName(listener.getEventName());
javaScriptActionPane.setResourceInfo(new JavaScriptResourceInfo(JavaScriptResourceInfo.Type.WEB_CONFIG, Toolkit.i18nText(actionLocaleName)));
JavaScriptResourceInfo.PathNode pathNode = JavaScriptResourceInfo.PathNode.create(JavaScriptResourceInfo.Type.WEB_CONFIG, Toolkit.i18nText(actionLocaleName));
JavaScriptResourceInfo javaScriptResourceInfo = new JavaScriptResourceInfo().addFirstPathNode(pathNode);
javaScriptActionPane.setResourceInfo(javaScriptResourceInfo);
this.listener.setEventName(this.nameText.getText());
FurtherBasicBeanPane<? extends JavaScript> pane = this.cards.get(this.styleBox.getSelectedIndex());
this.listener.setAction(pane.updateBean());

2
designer-realize/src/main/java/com/fr/design/mainframe/CellWidgetPropertyPane.java

@ -3,6 +3,7 @@ package com.fr.design.mainframe;
import com.fr.design.actions.utils.ReportActionUtils;
import com.fr.design.dialog.BasicPane;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.utils.gui.AdjustWorkBookDefaultStyleUtils;
import com.fr.design.widget.WidgetPane;
import com.fr.form.ui.NoneWidget;
import com.fr.form.ui.Widget;
@ -89,6 +90,7 @@ public class CellWidgetPropertyPane extends BasicPane {
TemplateCellElement editCellElement = tplEC.getTemplateCellElement(cs.getColumn(), cs.getRow());
if (editCellElement == null) {
editCellElement = new DefaultTemplateCellElement(cs.getColumn(), cs.getRow());
AdjustWorkBookDefaultStyleUtils.adjustCellElement(editCellElement);
}
this.cellElement = editCellElement;
this.populate(editCellElement);

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.general.ComparatorUtils;
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.bridge.StableFactory;
import org.jetbrains.annotations.Nullable;
@ -90,13 +92,16 @@ class FormApp extends AbstractAppProvider {
@Nullable
private Form getForm(FILE tplFile) {
ReadXmlTypeLocalManager.setReadXmlType(ReadXmlType.DESIGN);
Form form = asIOFile(tplFile);
ReadXmlTypeLocalManager.remove();
if (form != null) {
DesignerAppUtils.dealWithTemplateIOError(tplFile.getPath());
}
return form;
}
@Override
public Form asIOFile(FILE file) {

16
designer-realize/src/main/java/com/fr/design/mainframe/cell/CellElementEditPane.java

@ -7,10 +7,14 @@ import com.fr.design.gui.frpane.AttributeChangeListener;
import com.fr.design.gui.ibutton.UIHeadGroup;
import com.fr.design.gui.itabpane.TitleChangeListener;
import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.mainframe.cell.settingpane.*;
import com.fr.design.mainframe.cell.settingpane.AbstractCellAttrPane;
import com.fr.design.mainframe.cell.settingpane.CellExpandAttrPane;
import com.fr.design.mainframe.cell.settingpane.CellOtherSetPane;
import com.fr.design.mainframe.cell.settingpane.CellPresentPane;
import com.fr.design.mainframe.cell.settingpane.CellStylePane;
import com.fr.design.utils.DesignUtils;
import com.fr.design.utils.gui.AdjustWorkBookDefaultStyleUtils;
import com.fr.general.ComparatorUtils;
import com.fr.grid.selection.CellSelection;
import com.fr.grid.selection.Selection;
import com.fr.report.cell.CellElement;
@ -18,8 +22,11 @@ import com.fr.report.cell.DefaultTemplateCellElement;
import com.fr.report.cell.TemplateCellElement;
import com.fr.report.elementcase.TemplateElementCase;
import javax.swing.*;
import java.awt.*;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Dimension;
import java.util.ArrayList;
import java.util.List;
@ -113,6 +120,7 @@ public class CellElementEditPane extends BasicPane {
CellElement cellElement = elementCase.getCellElement(cs.getColumn(), cs.getRow());
if (cellElement == null) {
cellElement = new DefaultTemplateCellElement(cs.getColumn(), cs.getRow());
AdjustWorkBookDefaultStyleUtils.adjustCellElement(cellElement);
//默认选中的是A1单元格,所以若是A1单元格没有加到列表时要加上,否则在聚合报表时会出错
if (cs.isSelectedOneCell(elementCasePane) && (cs.getColumn() + cs.getRow() == 0)) {
elementCase.addCellElement((TemplateCellElement) cellElement);

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;
if (grid != null) {
boolean oldTranslucent = grid.isTranslucent();
boolean oldShowExtraGridLine = grid.isShowExtraGridLine();
// 截缩图图时grid需支持半透明,不能用默认白色填充画布,否则会遮挡组件样式背景
grid.setTranslucent(true);
grid.setShowExtraGridLine(false);
grid.paint(g2d);
grid.setTranslucent(oldTranslucent);
grid.setShowExtraGridLine(oldShowExtraGridLine);
}
} catch (Exception e) {

8
designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java

@ -156,11 +156,15 @@ public class DesignerSocketIO {
private static String[] getSocketUri() throws IOException {
Workspace current = WorkContext.getCurrent();
URL url = new URL(current.getPath());
Integer[] ports = current.get(SocketInfoOperator.class).getPort();
Integer[] ports = WebSocketConfig.getInstance().getAvailablePorts();
WorkspaceConnection connection = current.getConnection();
// 服务器配置https webSocket可能是wss也可能是ws webSocket的协议可以单独配置
WebSocketProtocol webSocketProtocol = WebSocketConfig.getInstance().getProtocol();
currentProtocol = webSocketProtocol == WebSocketProtocol.PLAIN ? HTTP : HTTPS;
if (WebSocketConfig.getInstance().isUsingProxy()) {
// 如果配置了代理服务器跟随服务器协议
currentProtocol = url.getProtocol();
}
String[] result = new String[ports.length];
for (int i = 0; i < ports.length; i++) {
result[i] = String.format("%s://%s:%s%s?%s=%s&%s=%s",
@ -173,7 +177,7 @@ public class DesignerSocketIO {
RemoteDesignConstants.USER_LOCK_ID,
connection.getId());
}
FineLoggerFactory.getLogger().error("Available ports: {}, current Protocol: {}", Arrays.toString(ports), currentProtocol);
FineLoggerFactory.getLogger().info("Available ports: {}, current Protocol: {}", Arrays.toString(ports), currentProtocol);
return result;
}

2
designer-realize/src/main/java/com/fr/design/present/ConditionAttributesGroupPane.java

@ -7,6 +7,7 @@ import com.fr.design.gui.controlpane.NameableCreator;
import com.fr.design.gui.controlpane.UIListControlPane;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.utils.gui.AdjustWorkBookDefaultStyleUtils;
import com.fr.general.NameObject;
import com.fr.grid.selection.CellSelection;
import com.fr.grid.selection.Selection;
@ -83,6 +84,7 @@ public class ConditionAttributesGroupPane extends UIListControlPane {
editCellElement = tplEC.getTemplateCellElement(cs.getColumn(), cs.getRow());
if (editCellElement == null) {
editCellElement = new DefaultTemplateCellElement(cs.getColumn(), cs.getRow());
AdjustWorkBookDefaultStyleUtils.adjustCellElement(editCellElement);
}
SheetUtils.calculateDefaultParent(tplEC); // 不知道这行代码的作用,怕去掉之后会出问题,先放在这里

20
designer-realize/src/main/java/com/fr/design/webattr/EditToolBar.java

@ -519,7 +519,10 @@ public class EditToolBar extends BasicPane {
if (javaScriptPane == null || ((CustomToolBarButton) widget).getJSImpl() == null) {
javaScriptPane = JavaScriptActionPane.createDefault();
}
javaScriptPane.setResourceInfo(new JavaScriptResourceInfo(JavaScriptResourceInfo.Type.WIDGET, ((Button) widget).getText()));
JavaScriptResourceInfo.PathNode pathNode = JavaScriptResourceInfo.PathNode.create(JavaScriptResourceInfo.Type.WIDGET, ((Button) widget).getText());
JavaScriptResourceInfo javaScriptResourceInfo = new JavaScriptResourceInfo().addFirstPathNode(pathNode);
javaScriptPane.setResourceInfo(javaScriptResourceInfo);
javaScriptPane.setPreferredSize(new Dimension(750, 500));
BasicDialog dialog = javaScriptPane.showWindow(SwingUtilities.getWindowAncestor(ButtonPane.this));
@ -541,6 +544,7 @@ public class EditToolBar extends BasicPane {
/**
* 更新
*
* @param widget 对应组件
*/
public void populate(Widget widget) {
@ -572,7 +576,7 @@ public class EditToolBar extends BasicPane {
count.setValue(((AppendColumnRow) widget).getCount());
}
private void populateExport(){
private void populateExport() {
card.show(centerPane, "export");
Export export = (Export) widget;
this.pdf.setSelected(export.isPdfAvailable());
@ -581,9 +585,10 @@ public class EditToolBar extends BasicPane {
this.excelS.setSelected(export.isExcelSAvailable());
this.word.setSelected(export.isWordAvailable());
this.image.setSelected(export.isImageAvailable());
if(exportToolBarProviders != null){
for(int i=0; i<exportToolBarProviders.length; i++){
exportToolBarProviders[i].populate();;
if (exportToolBarProviders != null) {
for (int i = 0; i < exportToolBarProviders.length; i++) {
exportToolBarProviders[i].populate();
;
}
}
}
@ -694,7 +699,10 @@ public class EditToolBar extends BasicPane {
if (customToolBarButton.getJSImpl() == null) {
this.javaScriptPane = JavaScriptActionPane.createDefault();
}
javaScriptPane.setResourceInfo(new JavaScriptResourceInfo(JavaScriptResourceInfo.Type.CUSTOM_BUTTON, ((Button) widget).getText()));
JavaScriptResourceInfo.PathNode pathNode = JavaScriptResourceInfo.PathNode.create(JavaScriptResourceInfo.Type.CUSTOM_BUTTON, ((Button) widget).getText());
JavaScriptResourceInfo javaScriptResourceInfo = new JavaScriptResourceInfo().addFirstPathNode(pathNode);
javaScriptPane.setResourceInfo(javaScriptResourceInfo);
customToolBarButton.setJSImpl(this.javaScriptPane.updateBean());
}

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.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.i18n.DesignSizeI18nManager;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.widget.FRWidgetFactory;
import com.fr.file.FILE;
@ -38,7 +39,7 @@ public class WebCssPane extends BasicPane {
JPanel outnorth = new JPanel(new BorderLayout(0, 5));
JPanel northPane = new JPanel(new FlowLayout(FlowLayout.LEFT,8,0));
localText = new UITextField();
localText.setPreferredSize(new Dimension(450, 20));
localText.setPreferredSize(DesignSizeI18nManager.getInstance().i18nDimension("com.fr.design.web.pane.text.field"));
localText.setEditable(false);
chooseFile = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Selection"));
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.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.i18n.DesignSizeI18nManager;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.widget.FRWidgetFactory;
import com.fr.file.FILE;
@ -66,8 +67,8 @@ public class WebJsPane extends BasicPane {
localText = new UITextField();
localText.setEditable(false);
urlText = new UITextField();
localText.setPreferredSize(new Dimension(450, 20));
urlText.setPreferredSize(new Dimension(450, 20));
localText.setPreferredSize(DesignSizeI18nManager.getInstance().i18nDimension("com.fr.design.web.pane.text.field"));
urlText.setPreferredSize(DesignSizeI18nManager.getInstance().i18nDimension("com.fr.design.web.pane.text.field"));
urlText.addKeyListener(urlTextListener);
urlText.setEnabled(false);
chooseFile = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Selection"));

14
designer-realize/src/main/java/com/fr/design/widget/WidgetEventPane.java

@ -70,11 +70,13 @@ public class WidgetEventPane extends UIListGroupControlPane {
public static class WidgetEventListenerUpdatePane extends ListenerUpdatePane {
private ElementCasePane epane;
// 反射会用到
public WidgetEventListenerUpdatePane() {
this(null);
}
public WidgetEventListenerUpdatePane(ElementCasePane epane){
public WidgetEventListenerUpdatePane(ElementCasePane epane) {
this.epane = epane;
super.initComponents();
}
@ -94,7 +96,7 @@ public class WidgetEventPane extends UIListGroupControlPane {
@Override
protected DBManipulationPane createDBManipulationPane() {
if(epane == null && DesignerContext.getDesignerFrame().getSelectedJTemplate() != null) {
if (epane == null && DesignerContext.getDesignerFrame().getSelectedJTemplate() != null) {
return autoCreateDBManipulationInWidgetEventPane();
}
@ -191,7 +193,13 @@ public class WidgetEventPane extends UIListGroupControlPane {
public void wrapperListener(Listener listener) {
if (listener.getAction() instanceof Commit2DBJavaScript) {
Commit2DBJavaScript commit2DBJavaScript = (Commit2DBJavaScript) listener.getAction();
commit2DBJavaScript.setJsResourceInfo(new JavaScriptResourceInfo(JavaScriptResourceInfo.Type.WIDGET, targetWidget.getWidgetName()));
JavaScriptResourceInfo.PathNode widgetNode = JavaScriptResourceInfo.PathNode.create(JavaScriptResourceInfo.Type.WIDGET, targetWidget.getWidgetName());
JavaScriptResourceInfo.PathNode EventNode = JavaScriptResourceInfo.PathNode.create(JavaScriptResourceInfo.Type.EVENT, listener.getName());
JavaScriptResourceInfo javaScriptResourceInfo = new JavaScriptResourceInfo()
.addFirstPathNode(EventNode)
.addFirstPathNode(widgetNode);
commit2DBJavaScript.setJsResourceInfo(javaScriptResourceInfo);
}
}

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() {
@Override
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)) {
dragType = GridUtils.DRAG_CELL_SIZE;
isDragPermited = true;
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;
}
if (between(evt, tmpSize1, tmpSize2)) {
@ -302,21 +300,18 @@ public abstract class AbstractGridHeaderMouseHandler extends MouseInputAdapter {
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 resolution = ScreenResolution.getScreenResolution();
FU ulen = FU.valueOfPix((int) doubleValue, resolution);
FU tulen = FU.valueOfPix((int) totalDoubleValue, resolution);
ReportLengthUNITProvider lengthUNIT = UnitConvertUtil.parseLengthUNIT(unitType);
String unit = lengthUNIT.unitText();
double len = lengthUNIT.unit2Value4Scale(ulen);
double tlen = lengthUNIT.unit2Value4Scale(tulen);
double len = lengthUNIT.unit2Value4Scale(unitValue);
double tlen = lengthUNIT.unit2Value4Scale(totalUnitValue);
StringBuilder sb = new StringBuilder();
sb.append(String.format("%.2f", new Double(len)))
.append('/').append(String.format("%.2f", new Double(tlen)))
.append(unit).append('(')
.append((int)(doubleValue)).append('/')
.append((int)(totalDoubleValue))
.append((int)(unitValue.toPixD(resolution))).append('/')
.append((int)(totalUnitValue.toPixD(resolution)))
.append(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Px"))
.append(')');
return sb.toString();
@ -416,8 +411,7 @@ public abstract class AbstractGridHeaderMouseHandler extends MouseInputAdapter {
iterateScrollBar(ePane, evt, DRAG_ACTION);
DynamicUnitList sizeList = getSizeList(report);
// int resolution = ScreenResolution.getScreenResolution();
this.setToolTipText2(this.createToolTipString(sizeList.get(dragIndex).toPixD(resolution), sizeList.getRangeValue(0, dragIndex + 1).toPixD(resolution)));
this.setToolTipText2(this.createToolTipString(sizeList.get(dragIndex), sizeList.getRangeValue(0, dragIndex + 1)));
}
ePane.repaint();

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

@ -18,6 +18,7 @@ import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.mainframe.DesignOperationEvent;
import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.utils.gui.AdjustWorkBookDefaultStyleUtils;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.event.EventDispatcher;
import com.fr.general.ComparatorUtils;
@ -136,6 +137,8 @@ public class Grid extends BaseGridComponent {
// 截取缩略图时需透明(不能用默认白色填充),否则会遮挡组件样式的背景,其余情况的绘制可以用白色等默认颜色填充
private boolean isTranslucent = false;
// 是否绘制单元格内容区之外的网格线
private boolean showExtraGridLine = true;
public Grid(int resolution) {
this.resolution = resolution;
@ -871,6 +874,7 @@ public class Grid extends BaseGridComponent {
// 必须保证editingCellElement不是null。
if (editingCellElement == null) {
editingCellElement = new DefaultTemplateCellElement(column, row);
AdjustWorkBookDefaultStyleUtils.adjustCellElement(editingCellElement);
}
editorComponent = getCellEditingComp();
if (editorComponent == null) {
@ -1036,6 +1040,7 @@ public class Grid extends BaseGridComponent {
if (editingCellElement == null) {
editingCellElement = new DefaultTemplateCellElement(editingColumn, editingRow);
tplEC.addCellElement(editingCellElement);
AdjustWorkBookDefaultStyleUtils.adjustCellElement(editingCellElement);
}
if (setValue4EditingElement(newValue)) {
shrinkToFit(tplEC);
@ -1469,4 +1474,12 @@ public class Grid extends BaseGridComponent {
public void setTranslucent(boolean translucent) {
isTranslucent = translucent;
}
public boolean isShowExtraGridLine() {
return showExtraGridLine;
}
public void setShowExtraGridLine(boolean showExtraGridLine) {
this.showExtraGridLine = showExtraGridLine;
}
}

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

@ -10,12 +10,14 @@ import com.fr.base.background.ColorBackground;
import com.fr.base.background.ImageFileBackground;
import com.fr.base.iofile.attr.WatermarkAttr;
import com.fr.base.vcs.DesignerMode;
import com.fr.design.base.mode.DesignModeContext;
import com.fr.design.constants.UIConstants;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.roleAuthority.ReportAndFSManagePane;
import com.fr.design.utils.gui.AdjustWorkBookDefaultStyleUtils;
import com.fr.general.Background;
import com.fr.general.ComparatorUtils;
import com.fr.grid.selection.CellSelection;
@ -43,11 +45,12 @@ import com.fr.report.stable.ReportConstants;
import com.fr.report.stable.ReportSettings;
import com.fr.report.worksheet.FormElementCase;
import com.fr.report.worksheet.WorkSheet;
import com.fr.stable.AssistUtils;
import com.fr.stable.ColumnRow;
import com.fr.stable.Constants;
import com.fr.stable.script.CalculatorUtils;
import com.fr.stable.unit.FU;
import com.fr.stable.AssistUtils;
import com.fr.stable.unit.UNIT;
import com.fr.third.antlr.ANTLRException;
import com.fr.third.guava.collect.HashMultimap;
@ -172,7 +175,7 @@ public class GridUI extends ComponentUI {
// denny:画背景.Background
Background background = reportSettings.getBackground();
if (background != null) {
if (background != null && !DesignModeContext.isDuchampMode()) {
// denny: except the ColorBackground and ImageBackground
if (grid.isEnabled() && !(background instanceof ImageFileBackground)) {
background.paint(g2d, this.back_or_selection_rect);
@ -185,7 +188,7 @@ public class GridUI extends ComponentUI {
private void clearBackground(Graphics2D g2d, Grid grid) {
if (grid.isEnabled()) {
g2d.setPaint(Color.WHITE);
g2d.setPaint(AdjustWorkBookDefaultStyleUtils.adjustBack(Color.WHITE));
} else {
g2d.setPaint(UIManager.getColor("control"));
}
@ -288,15 +291,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)
.realSize(realWidth, realHeight);
new DrawVerticalLineHelper(gridRange, grid.isShowGridLine(),
new DrawVerticalLineHelper(gridRange, grid.isShowGridLine(), grid.isShowExtraGridLine(),
isShowVerticalPaginateLine, paperPaintHeight,
paginateLineList, resolution).iterateStart2End(g2d);
new DrawHorizontalLineHelper(gridRange, grid.isShowGridLine(),
new DrawHorizontalLineHelper(gridRange, grid.isShowGridLine(), grid.isShowExtraGridLine(),
isShowHorizontalPaginateLine, paperPaintWidth,
paginateLineList, resolution).iterateStart2End(g2d);
}
@ -320,6 +333,7 @@ public class GridUI extends ComponentUI {
protected GridRange gridRange;
protected boolean showGridLine;
protected boolean showExtraGridLine;
protected boolean showPaginateLine;
protected double paperPaintSize;
@ -332,11 +346,12 @@ public class GridUI extends ComponentUI {
protected static final double THRESHOLD = 1.0E-4D;
DrawLineHelper(GridRange gridRange, boolean showGridLine,
DrawLineHelper(GridRange gridRange, boolean showGridLine, boolean showExtraGridLine,
boolean showPaginateLine, double paperPaintSize,
List paginateLineList, int resolution) {
this.gridRange = gridRange;
this.showGridLine = showGridLine;
this.showExtraGridLine = showExtraGridLine;
this.showPaginateLine = showPaginateLine;
this.paperPaintSize = paperPaintSize;
@ -353,10 +368,10 @@ public class GridUI extends ComponentUI {
private class DrawVerticalLineHelper extends DrawLineHelper {
DrawVerticalLineHelper(GridRange gridRange, boolean showGridLine,
DrawVerticalLineHelper(GridRange gridRange, boolean showGridLine, boolean showExtraGridLine,
boolean showPaginateLine, double paperPaintSize,
List paginateLineList, int resolution) {
super(gridRange, showGridLine, showPaginateLine,
super(gridRange, showGridLine, showExtraGridLine, showPaginateLine,
paperPaintSize, paginateLineList, resolution);
}
@ -372,51 +387,58 @@ public class GridUI extends ComponentUI {
@Override
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++) {
if (i == 0) {
i = gridRange.yBeginIndex;
for (int k = 0; k < gridRange.yBeginIndex; k++) {
rowHeight = gridRange.rowHeightList.get(k).toPixF(resolution);
paperYAxisSumSize += rowHeight;
if (paperYAxisSumSize >= paperPaintSize) {
rowHeight = gridRange.rowHeightList.get(k);
paperYAxisSumSize = paperYAxisSumSize.add(rowHeight);
if (paperYAxisSumSize.toPixF(resolution) >= paperPaintSize) {
paperYAxisSumSize = rowHeight;
}
}
}
rowHeight = gridRange.rowHeightList.get(i).toPixF(resolution);
paperYAxisSumSize += rowHeight;
rowHeight = gridRange.rowHeightList.get(i);
paperYAxisSumSize = paperYAxisSumSize.add(rowHeight);
if (showGridLine) {
float columnWidth, xAxisSumSize = 0;
UNIT columnWidth, xAxisSumSize = FU.getInstance(0);
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)) {
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);
}
xAxisSumSize += columnWidth;
xAxisSumSize = xAxisSumSize.add(columnWidth);
}
if (xAxisSumSize.toPixF(resolution) > maxXAxisSumSize.toPixF(resolution)) {
maxXAxisSumSize = xAxisSumSize;
}
}
if (showPaginateLine && paperYAxisSumSize - paperPaintSize > THRESHOLD) {
paginateLineList.add(getPaginateLine2D((int) yAxisSumSize));
if (showPaginateLine && paperYAxisSumSize.toPixF(resolution) - paperPaintSize > THRESHOLD) {
paginateLineList.add(getPaginateLine2D((int) yAxisSumSize.toPixF(resolution)));
paperYAxisSumSize = rowHeight;
}
yAxisSumSize += rowHeight;
yAxisSumSize = yAxisSumSize.add(rowHeight);
}
// paint 最后一个横线..
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 {
DrawHorizontalLineHelper(GridRange gridRange, boolean showGridLine,
DrawHorizontalLineHelper(GridRange gridRange, boolean showGridLine, boolean showExtraGridLine,
boolean showPaginateLine, double paperPaintSize,
List paginateLineList, int resolution) {
super(gridRange, showGridLine, showPaginateLine,
super(gridRange, showGridLine, showExtraGridLine, showPaginateLine,
paperPaintSize, paginateLineList, resolution);
}
@ -432,40 +454,47 @@ public class GridUI extends ComponentUI {
@Override
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++) {
if (i == 0) {
i = gridRange.xBeginIndex;
for (int k = 0; k < gridRange.xBeginIndex; k++) {
columnWidth = gridRange.columnWidthList.get(k).toPixF(resolution);
paperXAxisSumSize += columnWidth;
if (paperXAxisSumSize >= paperPaintSize) {
columnWidth = gridRange.columnWidthList.get(k);
paperXAxisSumSize = paperXAxisSumSize.add(columnWidth);
if (paperXAxisSumSize.toPixF(resolution) >= paperPaintSize) {
paperXAxisSumSize = columnWidth;
}
}
}
columnWidth = gridRange.columnWidthList.get(i).toPixF(resolution);
paperXAxisSumSize += columnWidth;
columnWidth = gridRange.columnWidthList.get(i);
paperXAxisSumSize = paperXAxisSumSize.add(columnWidth);
if (showGridLine) {
float rowHeight, yAxisSumSize = 0;
UNIT rowHeight, yAxisSumSize = FU.getInstance(0);
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)) {
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);
}
yAxisSumSize += rowHeight;
yAxisSumSize = yAxisSumSize.add(rowHeight);
}
if (yAxisSumSize.toPixF(resolution) > maxYAxisSumSize.toPixF(resolution)) {
maxYAxisSumSize = yAxisSumSize;
}
}
if (showPaginateLine && paperXAxisSumSize - paperPaintSize > THRESHOLD) {
paginateLineList.add(getPaginateLine2D((int) xAxisSumSize));
if (showPaginateLine && paperXAxisSumSize.toPixF(resolution) - paperPaintSize > THRESHOLD) {
paginateLineList.add(getPaginateLine2D((int) xAxisSumSize.toPixF(resolution)));
paperXAxisSumSize = columnWidth;
}
xAxisSumSize += columnWidth;
xAxisSumSize = xAxisSumSize.add(columnWidth);
}
// paint 最后一个横线..
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));
}
}
}
}

3
designer-realize/src/main/java/com/fr/grid/dnd/ElementCasePaneDropTarget.java

@ -5,6 +5,7 @@ import com.fr.design.actions.UpdateAction;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.gui.ibutton.UIToggleButton;
import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.utils.gui.AdjustWorkBookDefaultStyleUtils;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.data.TableDataColumn;
import com.fr.grid.Grid;
@ -251,7 +252,7 @@ public class ElementCasePaneDropTarget extends DropTargetAdapter {
cellExPandAttr.setDirection(Constants.TOP_TO_BOTTOM);
if (curCellElement == null) {
curCellElement = new DefaultTemplateCellElement(cs.getColumn(), cs.getRow(), cs.getColumnSpan(), cs.getRowSpan(), newLinearDSColumn);
AdjustWorkBookDefaultStyleUtils.adjustCellElement(curCellElement);
report.addCellElement(curCellElement);
} else {
// marks:直接覆盖值

1
designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceActivator.java

@ -53,6 +53,7 @@ public class DesignerWorkspaceActivator extends Activator {
public void on(Event event, Workspace workspace) {
PluginClassRefreshManager.getInstance().removePluginListener();
HistoryTemplateListCache.getInstance().stash();
PluginClassRefreshManager.getInstance().fireTabChange();
}
});

Loading…
Cancel
Save