Browse Source

Merge pull request #13 in ~NEIL/design from release/10.0 to feature/10.0

* commit '90134066559ecdb5326abc4a010a37fd6cfbf12a':
  REPORT-14057 10.0日文国际化问题处理=>28 checkbox文字显示不全
  REPORT-14057 10.0日文国际化问题处理=>重构
  REPORT-14057 10.0日文国际化问题处理=>26 下拉框显示不全,相关问题
  REPORT-14057 10.0日文国际化问题处理=>简单重构
  REPORT-14057 10.0日文国际化问题处理=>26 下拉框显示不全
  REPORT-13544 填报属性设置-自定义按钮有点问题,9.0也存在
  REPORT-13802
  REPORT-14057 10.0日文国际化问题处理=>25 tab标题显示不全
  REPORT-14057 10.0日文国际化问题处理=>面板重构;问题14
  REPORT-14057 10.0日文国际化问题处理=>面板重构
  REPORT-14057 10.0日文国际化问题处理=>问题9、问题10 显示不全
  REPORT-14057 10.0日文国际化问题处理=>问题8 浏览器背景,标签显示不全
  REPORT-14057 10.0日文国际化问题处理=>问题7 控件名称显示不全
  REPORT-14057 10.0日文国际化问题处理=>问题4
  REPORT-13673 设计器报错收集信息请求太多,要么合并起来发送zip到后端,要么后端就拒收了 200条合并为1个请求发送; 发送失败本地缓存文件不会删除
  KERNEL-216 去掉奇葩的JsonDecode使用
  REPORT-14092 [FindBugs问题修复]
  REPORT-14093 [FindBugs问题修复] 不需要public static的单例
research/10.0
neil 6 years ago
parent
commit
6f64f66b95
  1. 16
      designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java
  2. 7
      designer-base/src/main/java/com/fr/design/actions/file/WebPreviewUtils.java
  3. 10
      designer-base/src/main/java/com/fr/design/gui/core/UITextComponent.java
  4. 44
      designer-base/src/main/java/com/fr/design/gui/ibutton/UIButton.java
  5. 20
      designer-base/src/main/java/com/fr/design/gui/ibutton/UIHeadGroup.java
  6. 3
      designer-base/src/main/java/com/fr/design/gui/icheckbox/UICheckBox.java
  7. 5
      designer-base/src/main/java/com/fr/design/gui/ilable/UILabel.java
  8. 2
      designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogMessageBar.java
  9. 27
      designer-base/src/main/java/com/fr/design/style/background/gradient/GradientBackgroundPane.java
  10. 51
      designer-base/src/main/java/com/fr/design/utils/gui/GUICoreUtils.java
  11. 51
      designer-base/src/main/java/com/fr/design/utils/gui/UIComponentUtils.java
  12. 2
      designer-base/src/main/resources/com/fr/design/insert/formula/variable/cn/contextPath.txt
  13. 2
      designer-base/src/main/resources/com/fr/design/insert/formula/variable/cn/formletName.txt
  14. 2
      designer-base/src/main/resources/com/fr/design/insert/formula/variable/cn/reportName.txt
  15. 2
      designer-base/src/main/resources/com/fr/design/insert/formula/variable/cn/serverName.txt
  16. 2
      designer-base/src/main/resources/com/fr/design/insert/formula/variable/cn/serverSchema.txt
  17. 2
      designer-base/src/main/resources/com/fr/design/insert/formula/variable/cn/serverURL.txt
  18. 2
      designer-base/src/main/resources/com/fr/design/insert/formula/variable/en/contextPath.txt
  19. 2
      designer-base/src/main/resources/com/fr/design/insert/formula/variable/en/formletName.txt
  20. 2
      designer-base/src/main/resources/com/fr/design/insert/formula/variable/en/reportName.txt
  21. 2
      designer-base/src/main/resources/com/fr/design/insert/formula/variable/en/serverName.txt
  22. 2
      designer-base/src/main/resources/com/fr/design/insert/formula/variable/en/serverSchema.txt
  23. 2
      designer-base/src/main/resources/com/fr/design/insert/formula/variable/en/serverURL.txt
  24. 109
      designer-base/src/test/java/com/fr/design/utils/gui/UIComponentUtilsTest.java
  25. 11
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/AlphaFineHelper.java
  26. 4
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/HotIssuesManager.java
  27. 107
      designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellOtherSetPane.java
  28. 31
      designer-realize/src/main/java/com/fr/design/mainframe/errorinfo/ErrorInfoUploader.java
  29. 134
      designer-realize/src/main/java/com/fr/design/report/WriteShortCutsPane.java
  30. 18
      designer-realize/src/main/java/com/fr/design/webattr/EditToolBar.java
  31. 39
      designer-realize/src/main/java/com/fr/design/webattr/ToolBarDragPane.java
  32. 2
      designer-realize/src/main/java/com/fr/design/webattr/WebCssPane.java
  33. 2
      designer-realize/src/main/java/com/fr/design/webattr/WebJsPane.java
  34. 10
      designer-realize/src/main/java/com/fr/design/widget/ui/MultiFileEditorPane.java

16
designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java

@ -23,6 +23,7 @@ import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.design.utils.gui.UIComponentUtils;
import com.fr.general.ComparatorUtils;
import com.fr.general.FRFont;
import com.fr.general.Inter;
@ -32,8 +33,17 @@ import com.fr.third.apache.log4j.Level;
import com.fr.transaction.Configurations;
import com.fr.transaction.Worker;
import javax.swing.*;
import java.awt.*;
import javax.swing.BorderFactory;
import javax.swing.JFileChooser;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.KeyStroke;
import javax.swing.SwingUtilities;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Window;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyAdapter;
@ -61,6 +71,7 @@ public class PreferencePane extends BasicPane {
private static final int CACHING_MAX = 10;
private static final int CACHING_DEFAULT = 5;
private static final int CACHING_GAP = 5;
private static final int MEMORY_TIP_LABEL_MAX_WIDTH = 230;
private static final String TYPE = "pressed";
private static final String DISPLAY_TYPE = "+";
@ -472,6 +483,7 @@ public class PreferencePane extends BasicPane {
JPanel memoryPane = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preference_Caching_Template"));
UILabel memoryLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preference_Max_Caching_Template"));
UILabel memoryTipLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preference_Caching_Template_Tip"));
UIComponentUtils.setLineWrap(memoryTipLabel, MEMORY_TIP_LABEL_MAX_WIDTH);
memoryTipLabel.setBorder(BorderFactory.createEmptyBorder(0, CACHING_GAP, 0, 0));
cachingTemplateSpinner = new UISpinner(0, CACHING_MAX, 1, CACHING_DEFAULT);
JPanel memorySpace = new JPanel(FRGUIPaneFactory.createLeftZeroLayout());

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

@ -9,6 +9,7 @@ import com.fr.design.utils.DesignUtils;
import com.fr.file.FILE;
import com.fr.file.FileNodeFILE;
import com.fr.general.GeneralUtils;
import com.fr.general.web.ParameterConstants;
import com.fr.stable.project.ProjectConstants;
import com.fr.stable.web.AbstractWebletCreator;
@ -26,7 +27,11 @@ public final class WebPreviewUtils {
@SuppressWarnings("unchecked")
public static void preview(JTemplate<?, ?> jt, PreviewProvider provider) {
String baseRoute = jt.route();
actionPerformed(jt, baseRoute, provider == null ? Collections.EMPTY_MAP : provider.parametersForPreview(), provider.getActionType());
if (provider == null) {
actionPerformed(jt, baseRoute, Collections.EMPTY_MAP, ParameterConstants.VIEWLET);
} else {
actionPerformed(jt, baseRoute, provider.parametersForPreview(), provider.getActionType());
}
}
private static void actionPerformed(JTemplate<?, ?> jt, String baseRoute, Map<String, Object> map, String actionType) {

10
designer-base/src/main/java/com/fr/design/gui/core/UITextComponent.java

@ -0,0 +1,10 @@
package com.fr.design.gui.core;
/**
* 这个接口说明一个基本组件可以设置文本
* Created by plough on 2019/1/11.
*/
public interface UITextComponent {
String getText();
void setText(String text);
}

44
designer-base/src/main/java/com/fr/design/gui/ibutton/UIButton.java

@ -6,22 +6,36 @@ import com.fr.base.GraphHelper;
import com.fr.design.constants.UIConstants;
import com.fr.design.event.UIObserver;
import com.fr.design.event.UIObserverListener;
import com.fr.design.gui.core.UITextComponent;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.stable.Constants;
import com.fr.stable.StringUtils;
import com.fr.design.utils.gui.GUICoreUtils;
import javax.swing.*;
import javax.swing.Action;
import javax.swing.Icon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.ToolTipManager;
import javax.swing.plaf.ButtonUI;
import java.awt.*;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Insets;
import java.awt.Shape;
import java.awt.Stroke;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.geom.RoundRectangle2D;
public class UIButton extends JButton implements UIObserver {
public class UIButton extends JButton implements UIObserver, UITextComponent {
private static final int TOOLTIP_INIT_DELAY = 300; // 延迟 0.3s 显示提示文字
public static final int OTHER_BORDER = 1;
public static final int NORMAL_BORDER = 2;
private static final int HEIGH = 20;
private static final int HEIGHT = 20;
private boolean isExtraPainted = true;
private boolean isRoundBorder = true;
private int rectDirection = Constants.NULL;
@ -36,7 +50,6 @@ public class UIButton extends JButton implements UIObserver {
private CellBorderStyle border = null;
protected UIObserverListener uiObserverListener;
private static final int TOOLTIP_INIT_DELAY = 300; // 延迟 0.3s 显示提示文字
public UIButton() {
this(StringUtils.EMPTY);
@ -112,7 +125,7 @@ public class UIButton extends JButton implements UIObserver {
public void set4ToolbarButton() {
setNormalPainted(false);
Dimension dim = getPreferredSize();
dim.height = HEIGH;
dim.height = HEIGHT;
setBackground(null);
setOpaque(false);
setSize(dim);
@ -170,7 +183,11 @@ public class UIButton extends JButton implements UIObserver {
//@Override
public Dimension getPreferredSize() {
return new Dimension(super.getPreferredSize().width, 20);
Dimension dim = super.getPreferredSize();
if (isFixedHeight() || dim.height < HEIGHT) {
dim.height = HEIGHT;
}
return dim;
}
@ -323,7 +340,16 @@ public class UIButton extends JButton implements UIObserver {
this.isBorderPaintedOnlyWhenPressed = value;
}
/**
private boolean isFixedHeight() {
String text = this.getText();
if (StringUtils.isEmpty(text)) {
return true;
}
// 如果允许换行,需要放开按钮高度的限制
return !text.startsWith("<html>");
}
/**
* 主函数
* @param args 入口参数
*/

20
designer-base/src/main/java/com/fr/design/gui/ibutton/UIHeadGroup.java

@ -3,9 +3,15 @@ package com.fr.design.gui.ibutton;
import com.fr.base.BaseUtils;
import com.fr.design.constants.UIConstants;
import com.fr.design.utils.gui.GUICoreUtils;
import javax.swing.*;
import java.awt.*;
import com.fr.design.utils.gui.UIComponentUtils;
import javax.swing.Icon;
import javax.swing.JFrame;
import javax.swing.JPanel;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.GridLayout;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
@ -13,6 +19,7 @@ import java.util.ArrayList;
import java.util.List;
public class UIHeadGroup extends JPanel {
private static final int MIN_HEIGHT = 25;
protected List<UIToggleButton> labelButtonList;
private boolean isNeedLeftRightOutLine = true;
protected int selectedIndex = -1;
@ -25,7 +32,6 @@ public class UIHeadGroup extends JPanel {
labelButtonList = new ArrayList<UIToggleButton>(textArray.length);
this.setBackground(UIConstants.TREE_BACKGROUND);
this.setLayout(new GridLayout(0, textArray.length, 0, 0));
// this.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1));
for (int i = 0; i < textArray.length; i++) {
final int index = i;
String text = textArray[i];
@ -50,7 +56,6 @@ public class UIHeadGroup extends JPanel {
labelButtonList = new ArrayList<UIToggleButton>(iconArray.length);
this.setBackground(UIConstants.NORMAL_BACKGROUND);
this.setLayout(new GridLayout(0, iconArray.length, 1, 0));
// this.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1));
for (int i = 0; i < iconArray.length; i++) {
final int index = i;
Icon icon = iconArray[i];
@ -99,7 +104,9 @@ public class UIHeadGroup extends JPanel {
@Override
public Dimension getPreferredSize() {
Dimension dim = super.getPreferredSize();
dim.height = 25;
if (dim.height < MIN_HEIGHT) {
dim.height = MIN_HEIGHT;
}
return dim;
}
@ -133,6 +140,7 @@ public class UIHeadGroup extends JPanel {
labelButton.setRoundBorder(false);
labelButton.setBorderPainted(false);
labelButton.setPressedPainted(false);
UIComponentUtils.setLineWrap(labelButton);
labelButtonList.add(labelButton);
this.add(labelButton);
}

3
designer-base/src/main/java/com/fr/design/gui/icheckbox/UICheckBox.java

@ -5,6 +5,7 @@ import com.fr.design.event.GlobalNameListener;
import com.fr.design.event.GlobalNameObserver;
import com.fr.design.event.UIObserver;
import com.fr.design.event.UIObserverListener;
import com.fr.design.gui.core.UITextComponent;
import com.fr.design.utils.gui.GUIPaintUtils;
import com.fr.stable.Constants;
import sun.swing.SwingUtilities2;
@ -29,7 +30,7 @@ import java.awt.RenderingHints;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
public class UICheckBox extends JCheckBox implements UIObserver, GlobalNameObserver {
public class UICheckBox extends JCheckBox implements UIObserver, GlobalNameObserver, UITextComponent {
private UIObserverListener uiObserverListener;
private GlobalNameListener globalNameListener = null;
private String checkboxName = "";

5
designer-base/src/main/java/com/fr/design/gui/ilable/UILabel.java

@ -1,9 +1,9 @@
package com.fr.design.gui.ilable;
import com.fr.design.gui.core.UITextComponent;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.stable.StringUtils;
import com.fr.stable.StringUtils;
import javax.swing.Icon;
import javax.swing.JFrame;
import javax.swing.JLabel;
@ -19,7 +19,7 @@ import java.awt.Dimension;
* Date: 13-1-23
* Time: 下午3:15
*/
public class UILabel extends JLabel {
public class UILabel extends JLabel implements UITextComponent {
private static final int HTML_SHIFT_HEIGHT = 3;
public UILabel(String text, Icon image, int horizontalAlignment) {
@ -64,7 +64,6 @@ public class UILabel extends JLabel {
return preferredSize;
}
public static void main(String[] args) {
// UILabel label = new UILabel("shishi",SwingConstants.LEFT);
JFrame frame = new JFrame("Test");

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

@ -14,7 +14,7 @@ import java.awt.event.MouseEvent;
public class LogMessageBar extends JPanel {
private UILabel messageLabel;
private int width = 600;
public static volatile LogMessageBar THIS;
private static volatile LogMessageBar THIS;
private JFrame dlg = new LogDetailPane().showDialog();
public static LogMessageBar getInstance() {

27
designer-base/src/main/java/com/fr/design/style/background/gradient/GradientBackgroundPane.java

@ -1,24 +1,23 @@
package com.fr.design.style.background.gradient;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.ButtonGroup;
import com.fr.base.background.GradientBackground;
import com.fr.design.gui.ibutton.UIRadioButton;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.style.background.BackgroundDetailPane;
import com.fr.design.utils.gui.UIComponentUtils;
import com.fr.general.Background;
import javax.swing.BorderFactory;
import javax.swing.ButtonGroup;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import com.fr.base.background.GradientBackground;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.general.Background;
import com.fr.design.style.background.BackgroundDetailPane;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
/**
* 渐变色的面板不是很pp面板应用显得繁琐有写可以写成控件类型比如色彩选择的可以做得花哨点
@ -44,6 +43,8 @@ public class GradientBackgroundPane extends BackgroundDetailPane {
gradientBar = new GradientBar(4, 254);
blankJp.add(gradientBar);
UILabel jl = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Drag_To_Select_Gradient"));
jl.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 20));
UIComponentUtils.setLineWrap(jl);
jl.setHorizontalAlignment(SwingConstants.CENTER);
gradientPanel.add(jl, BorderLayout.NORTH);
gradientPanel.add(blankJp, BorderLayout.SOUTH);

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

@ -6,7 +6,13 @@ package com.fr.design.utils.gui;
import com.fr.base.BaseUtils;
import com.fr.base.Style;
import com.fr.base.background.ColorBackground;
import com.fr.data.util.function.*;
import com.fr.data.util.function.AverageFunction;
import com.fr.data.util.function.CountFunction;
import com.fr.data.util.function.DataFunction;
import com.fr.data.util.function.MaxFunction;
import com.fr.data.util.function.MinFunction;
import com.fr.data.util.function.NoneFunction;
import com.fr.data.util.function.SumFunction;
import com.fr.design.actions.UpdateAction;
import com.fr.design.actions.core.ActionFactory;
import com.fr.design.border.UITitledBorder;
@ -25,20 +31,48 @@ import com.fr.design.style.color.ColorFactory;
import com.fr.design.style.color.ColorSelectBox;
import com.fr.design.style.color.ColorSelectable;
import com.fr.general.FRFont;
import com.fr.stable.Constants;
import com.fr.stable.OperatingSystem;
import com.fr.stable.StringUtils;
import javax.swing.*;
import javax.swing.AbstractButton;
import javax.swing.Action;
import javax.swing.BorderFactory;
import javax.swing.Box;
import javax.swing.DefaultListModel;
import javax.swing.Icon;
import javax.swing.JComponent;
import javax.swing.JFormattedTextField;
import javax.swing.JList;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import javax.swing.JSeparator;
import javax.swing.JSlider;
import javax.swing.JSpinner;
import javax.swing.JTree;
import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import javax.swing.border.Border;
import javax.swing.border.LineBorder;
import javax.swing.border.TitledBorder;
import javax.swing.event.ChangeListener;
import javax.swing.tree.TreeNode;
import javax.swing.tree.TreePath;
import java.awt.*;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.GridLayout;
import java.awt.Image;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.Toolkit;
import java.awt.Window;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
@ -48,16 +82,17 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public abstract class GUICoreUtils{
// Noninstantiable utility class
public final class GUICoreUtils {
private static final int WINDOW_GAP = 20;
private static final int HEIGHT_GAP = 28;
private static final int WIN_LOCATION_Y=23;
private static final int CASE_FOUR = 4;
// 覆盖缺省构造器,不可实例化
private GUICoreUtils() {
throw new AssertionError();
}
/**

51
designer-base/src/main/java/com/fr/design/utils/gui/UIComponentUtils.java

@ -0,0 +1,51 @@
package com.fr.design.utils.gui;
import com.fr.design.gui.core.UITextComponent;
import com.fr.stable.StringUtils;
/**
* 包含 UI 组件相关的工具方法
* Created by plough on 2019/1/11.
*/
// Noninstantiable utility class
public class UIComponentUtils {
private static final String HTML_TAG_TPL = "<html><body style='width: %dpx'>";
private static final String HTML_BODY_TAG = "<html><body>";
private static final String HTML_TAG = "<html>";
private static final int MIN_WIDTH = 10;
// 覆盖缺省构造器,不可实例化
private UIComponentUtils() {
throw new AssertionError();
}
/**
* 到达指定宽度后换行
*/
public static void setLineWrap(UITextComponent comp, int width) {
if (width < MIN_WIDTH) {
width = MIN_WIDTH;
}
insertPrefixToText(comp, String.format(HTML_TAG_TPL, width));
}
/**
* 自动换行
*/
public static void setLineWrap(UITextComponent comp) {
insertPrefixToText(comp, HTML_BODY_TAG);
}
private static void insertPrefixToText(UITextComponent comp, String prefix) {
if (comp == null) {
return;
}
String text = comp.getText();
if (StringUtils.isEmpty(comp.getText()) || text.startsWith(HTML_TAG)) {
return;
}
comp.setText(prefix + comp.getText());
}
}

2
designer-base/src/main/resources/com/fr/design/insert/formula/variable/cn/contextPath.txt

@ -1 +1 @@
contextPath是指绝对路径的服务器别名,即虚拟目录.假如访问:http://localhost:8080/WebReport/ReportServer?reportlet=WorkBook1.cpt,contextPath是/WebReport
contextPath是指绝对路径的服务器别名,即虚拟目录.假如访问:http://localhost:8075/webroot/decision/view/report?viewlet=workbook1.cpt,contextPath是/webroot/decision/view

2
designer-base/src/main/resources/com/fr/design/insert/formula/variable/cn/formletName.txt

@ -1 +1 @@
表单名字假如访问:http://localhost:8080/WebReport/ReportServer?formlet=Form1.frm,formName就是Form1.frm
表单名字假如访问:http://localhost:8075/webroot/decision/view/form?viewlet=Form1.frm,formName就是Form1.frm

2
designer-base/src/main/resources/com/fr/design/insert/formula/variable/cn/reportName.txt

@ -1 +1 @@
报表名字假如访问:http://localhost:8080/WebReport/ReportServer?reportlet=WorkBook1.cpt,reportName就是WorkBook1.cpt
报表名字假如访问:http://localhost:8075/webroot/decision/view/report?viewlet=workbook1.cpt,reportName就是WorkBook1.cpt

2
designer-base/src/main/resources/com/fr/design/insert/formula/variable/cn/serverName.txt

@ -1 +1 @@
serverName,是指服务器地址或名称.假如访问:http://localhost:8080/WebReport/ReportServer?reportlet=WorkBook1.cpt,serverName指的是:localhost,即访问机子的IP
serverName,是指服务器地址或名称.假如访问:http://localhost:8075/webroot/decision/view/report?viewlet=workbook1.cpt,serverName指的是:localhost,即访问机子的IP

2
designer-base/src/main/resources/com/fr/design/insert/formula/variable/cn/serverSchema.txt

@ -1 +1 @@
serverSchema,是指协议名称.假如访问:http://localhost:8080/WebReport/ReportServer?reportlet=WorkBook1.cpt,serverSchema指的是:http
serverSchema,是指协议名称.假如访问:http://localhost:8075/webroot/decision/view/report?viewlet=workbook1.cpt,serverSchema指的是:http

2
designer-base/src/main/resources/com/fr/design/insert/formula/variable/cn/serverURL.txt

@ -1 +1 @@
serverURL是指访问服务的URL假如访问:http://localhost:8080/WebReport/ReportServer?reportlet=WorkBook1.cpt,serverURL就是http://localhost:8080
serverURL是指访问服务的URL假如访问:http://localhost:8075/webroot/decision/view/report?viewlet=workbook1.cpt,serverURL就是http://localhost:8075

2
designer-base/src/main/resources/com/fr/design/insert/formula/variable/en/contextPath.txt

@ -1 +1 @@
absolute path of the serverhttp://localhost:8080/WebReport/ReportServer?reportlet=WorkBook1.cpt,contextPath is /WebReport
absolute path of the server http://localhost:8075/webroot/decision/view/report?viewlet=workbook1.cpt,contextPath is /webroot/decision/view

2
designer-base/src/main/resources/com/fr/design/insert/formula/variable/en/formletName.txt

@ -1 +1 @@
form namehttp://localhost:8080/WebReport/ReportServer?formlet=Form1.frm,formName is Form1.frm
form name http://localhost:8075/webroot/decision/view/form?viewlet=Form1.frm,formName is Form1.frm

2
designer-base/src/main/resources/com/fr/design/insert/formula/variable/en/reportName.txt

@ -1 +1 @@
report namehttp://localhost:8080/WebReport/ReportServer?reportlet=WorkBook1.cpt,reportName is WorkBook1.cpt
report name http://localhost:8075/webroot/decision/view/report?viewlet=workbook1.cpt,reportName is WorkBook1.cpt

2
designer-base/src/main/resources/com/fr/design/insert/formula/variable/en/serverName.txt

@ -1 +1 @@
address or name of the serverhttp://localhost:8080/WebReport/ReportServer?reportlet=WorkBook1.cpt,serverName means localhost
address or name of the server http://localhost:8075/webroot/decision/view/report?viewlet=workbook1.cpt,serverName means localhost

2
designer-base/src/main/resources/com/fr/design/insert/formula/variable/en/serverSchema.txt

@ -1 +1 @@
serverSchemahttp://localhost:8080/WebReport/ReportServer?reportlet=WorkBook1.cpt,serverSchema is http
serverSchema http://localhost:8075/webroot/decision/view/report?viewlet=workbook1.cpt,serverSchema is http

2
designer-base/src/main/resources/com/fr/design/insert/formula/variable/en/serverURL.txt

@ -1 +1 @@
URL of the serverhttp://localhost:8080/WebReport/ReportServer?reportlet=WorkBook1.cpt,serverURL is http://localhost:8080
URL of the server http://localhost:8075/webroot/decision/view/report?viewlet=workbook1.cpt,serverURL is http://localhost:8075

109
designer-base/src/test/java/com/fr/design/utils/gui/UIComponentUtilsTest.java

@ -0,0 +1,109 @@
package com.fr.design.utils.gui;
import com.fr.design.gui.core.UITextComponent;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ilable.UILabel;
import com.fr.stable.StringUtils;
import org.junit.Before;
import org.junit.Test;
import javax.swing.Icon;
import java.awt.Component;
import java.awt.Graphics;
import static org.junit.Assert.*;
/**
* Created by plough on 2019/1/11.
*/
public class UIComponentUtilsTest {
private static final String HTML_TAG_TPL = "<html><body style='width: %dpx'>";
private static final String HTML_TAG = "<html>";
private UIButton textButton;
private UIButton emptyTextButton;
private UIButton iconButton;
private UILabel textLabel;
private UILabel emptyTextLabel;
private UILabel iconLabel;
@Before
public void setUp() {
textButton = new UIButton("hello");
emptyTextButton = new UIButton(StringUtils.EMPTY);
iconButton = new UIButton(createMockIcon());
textLabel = new UILabel("hello");
emptyTextLabel = new UILabel(StringUtils.EMPTY);
iconLabel = new UILabel(createMockIcon());
}
@Test
public void testSetLineWrap() {
UITextComponent[] noWrapComps = {emptyTextButton, emptyTextLabel, iconButton, iconLabel};
UITextComponent[] wrapComps = {textLabel, textButton};
for (UITextComponent comp : wrapComps) {
UIComponentUtils.setLineWrap(comp);
assertTrue(isLineWrapped(comp));
}
for (UITextComponent comp : noWrapComps) {
UIComponentUtils.setLineWrap(comp);
assertFalse(isLineWrapped(comp));
}
}
@Test
public void testSetLineWrapWithLineWidth() {
UILabel label1 = new UILabel("l1");
UILabel label2 = new UILabel("l2");
UILabel label3 = new UILabel("l3");
UIComponentUtils.setLineWrap(label1, 50);
assertTrue(isLineWrappedWithLineWidth(label1, 50));
UIComponentUtils.setLineWrap(label2, 0);
assertTrue(isLineWrappedWithLineWidth(label2, 10));
UIComponentUtils.setLineWrap(label3, -10);
assertTrue(isLineWrappedWithLineWidth(label3, 10));
}
@Test
public void testAddHtmlTwice() {
UIComponentUtils.setLineWrap(textLabel, 50);
UIComponentUtils.setLineWrap(textLabel, 20); // 第二次应该不生效
assertTrue(isLineWrappedWithLineWidth(textLabel, 50));
}
private boolean isLineWrapped(UITextComponent comp) {
String text = comp.getText();
return StringUtils.isNotEmpty(text) && text.startsWith(HTML_TAG);
}
private boolean isLineWrappedWithLineWidth(UITextComponent comp, int width) {
String text = comp.getText();
return StringUtils.isNotEmpty(text) && text.startsWith(String.format(HTML_TAG_TPL, width));
}
private Icon createMockIcon() {
return new Icon() {
@Override
public void paintIcon(Component c, Graphics g, int x, int y) {
// do nothing
}
@Override
public int getIconWidth() {
return 0;
}
@Override
public int getIconHeight() {
return 0;
}
};
}
}

11
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/AlphaFineHelper.java

@ -17,10 +17,11 @@ import com.fr.design.mainframe.alphafine.search.manager.impl.RecommendSearchMana
import com.fr.design.mainframe.alphafine.search.manager.impl.SimilarSearchManager;
import com.fr.general.ProcessCanceledException;
import com.fr.general.http.HttpToolbox;
import com.fr.json.JSON;
import com.fr.json.JSONArray;
import com.fr.json.JSONException;
import com.fr.json.JSONFactory;
import com.fr.json.JSONObject;
import com.fr.json.JSONUtils;
import com.fr.stable.StringUtils;
import java.util.List;
@ -110,7 +111,7 @@ public class AlphaFineHelper {
public static SearchResult getModelListFromJSONArray(String result, String keyword) throws ClassCastException, JSONException {
SearchResult allModelList = new SearchResult();
JSONArray jsonArray = (JSONArray) JSONUtils.jsonDecode(result);
JSONArray jsonArray = JSONFactory.createJSON(JSON.ARRAY, result);
for (int i = 0; i < jsonArray.length(); i++) {
AlphaFineHelper.checkCancel();
JSONObject jsonObject = jsonArray.optJSONObject(i);
@ -128,11 +129,12 @@ public class AlphaFineHelper {
/**
* 网络异常时的处理
*
* @param object
* @return
*/
public static SearchResult getNoConnectList(Object object) {
if (isNetworkOk()){
if (isNetworkOk()) {
return null;
}
SearchResult result = new SearchResult();
@ -153,9 +155,10 @@ public class AlphaFineHelper {
/**
* 判断网络是否异常
*
* @return
*/
public static boolean isNetworkOk(){
public static boolean isNetworkOk() {
try {
HttpToolbox.get(URL_FOR_TEST_NETWORK);
return true;

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

@ -6,8 +6,10 @@ import com.fr.design.mainframe.alphafine.cell.model.MoreModel;
import com.fr.design.mainframe.alphafine.cell.model.RobotModel;
import com.fr.design.mainframe.alphafine.model.SearchResult;
import com.fr.general.http.HttpToolbox;
import com.fr.json.JSON;
import com.fr.json.JSONArray;
import com.fr.json.JSONException;
import com.fr.json.JSONFactory;
import com.fr.json.JSONObject;
import com.fr.json.JSONUtils;
import com.fr.log.FineLoggerFactory;
@ -73,7 +75,7 @@ public class HotIssuesManager {
try {
String result = HttpToolbox.get(AlphaFineConstants.ALPHA_HOT_SEARCH);
JSONArray jsonArray = (JSONArray)JSONUtils.jsonDecode(result);
JSONArray jsonArray = JSONFactory.createJSON(JSON.ARRAY, result);
if(jsonArray != null){
for (int i = 0; i < HOT_ITEM_NUM; i++) {
AlphaFineHelper.checkCancel();

107
designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellOtherSetPane.java

@ -12,12 +12,13 @@ import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.*;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.layout.VerticalFlowLayout;
import com.fr.design.mainframe.EastRegionContainerPane;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.utils.gui.UIComponentUtils;
import com.fr.general.ComparatorUtils;
import com.fr.report.cell.DefaultTemplateCellElement;
import com.fr.report.cell.TemplateCellElement;
import com.fr.report.cell.cellattr.CellGUIAttr;
@ -26,10 +27,18 @@ import com.fr.report.cell.cellattr.CellPageAttr;
import com.fr.report.elementcase.TemplateElementCase;
import com.fr.stable.StringUtils;
import javax.swing.*;
import javax.swing.BorderFactory;
import javax.swing.ButtonGroup;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.*;
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Insets;
import java.awt.Rectangle;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
@ -41,8 +50,7 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
private static final int HEAD_WDITH = 290;
private static final int HEAD_HEIGTH = 24;
private static final Dimension NORMAL_DIMENSION = new Dimension(155, 20);
private static final Dimension SMALL_DIMENSION = new Dimension(150, 20);
private static final int COMBO_WIDTH = 154;
// normal
private UIButtonGroup autoshrik;
@ -77,7 +85,7 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
private ValueEditorPane valueEditor;
private CardLayout insertRowLayout;
private JPanel insertRowPane;
private JPanel southContentPane;
private JPanel insertRowPolicyPane;
private JPanel defaultValuePane;
/**
@ -129,6 +137,15 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
}
private JPanel seniorPane() {
initInsertRowPolicyPane();
JPanel seniorPane = new JPanel(new BorderLayout());
seniorPane.add(seniorUpPane(), BorderLayout.NORTH);
seniorPane.add(insertRowPolicyPane, BorderLayout.CENTER);
insertRowPolicyPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0));
return seniorPane;
}
private void initInsertRowPolicyPane() {
// 插入行策略
insertRowPolicy = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_CellWrite_InsertRow_NULL"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Estate_Default_Text"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_CellWrite_InsertRow_COPY")});
@ -161,16 +178,47 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_CellWrite_InsertRow_Policy"), SwingConstants.LEFT), insertRowPolicy},
new Component[]{null, insertRowPane},
};
southContentPane = TableLayoutHelper.createGapTableLayoutPane(components1, rowSize1, columnSize1, rowCount1, LayoutConstants.VGAP_LARGE, LayoutConstants.VGAP_MEDIUM);
JPanel seniorPane = new JPanel(new BorderLayout());
seniorPane.add(seniorUpPane(), BorderLayout.NORTH);
seniorPane.add(southContentPane, BorderLayout.CENTER);
southContentPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0));
return seniorPane;
insertRowPolicyPane = TableLayoutHelper.createGapTableLayoutPane(components1, rowSize1, columnSize1, rowCount1, LayoutConstants.VGAP_LARGE, LayoutConstants.VGAP_MEDIUM);
}
private JPanel seniorUpPane() {
JPanel pane = new JPanel(new BorderLayout());
// TODO: 方法之间的耦合还比较严重。现在必须先执行 createShowContentPane,再执行 createSeniorCheckPane。否则出现 npe。
pane.add(createShowContentPane(), BorderLayout.CENTER);
pane.add(createSeniorCheckPane(), BorderLayout.NORTH);
return pane;
}
private JPanel createShowContentPane() {
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
double[] rowSize = {p, p, p};
double[] colSize = {f, COMBO_WIDTH};
int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}};
JPanel fileNamePane = createNormal();
fileNamePane.setBorder(BorderFactory.createEmptyBorder(0,12,0,0));
UILabel showContentLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Show_Content"), SwingConstants.LEFT);
UILabel toolTipLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_CellWrite_ToolTip"));
UIComponentUtils.setLineWrap(toolTipLabel);
JPanel toolTipTextFieldWrapper = new JPanel(new BorderLayout());
toolTipTextFieldWrapper.add(tooltipTextField, BorderLayout.NORTH);
Component[][] components = new Component[][]{
new Component[]{showContentLabel, showContent},
new Component[]{fileNamePane, null}, // 选择"用下载连接显示二进制内容"时,会显示这一行的面板
new Component[]{toolTipLabel, toolTipTextFieldWrapper}
};
JPanel showContentPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, colSize, rowCount, LayoutConstants.VGAP_LARGE, LayoutConstants.VGAP_MEDIUM);
showContentPane.setBorder(BorderFactory.createEmptyBorder(6, 0, 12, 0));
return showContentPane;
}
private JPanel createSeniorCheckPane() {
previewCellContent.setBorder(UIConstants.CELL_ATTR_ZEROBORDER);
printAndExportContent.setBorder(UIConstants.CELL_ATTR_ZEROBORDER);
printAndExportBackground.setBorder(UIConstants.CELL_ATTR_ZEROBORDER);
@ -185,34 +233,7 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
new Component[]{printAndExportContent, null},
new Component[]{printAndExportBackground, null},
};
JPanel upPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_MEDIUM, LayoutConstants.VGAP_LARGE);
double[] downRowSize = {p, p, p, p, p, p};
double[] downColumnSize = {p, f};
int[][] downRowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}};
JPanel showContentPane = new JPanel(FRGUIPaneFactory.createRightZeroLayout());
showContent.setPreferredSize(SMALL_DIMENSION);
showContentPane.add(showContent);
fileNamePane.setBorder(BorderFactory.createEmptyBorder(0,12,0,0));
JPanel tooltipTextFieldPane = new JPanel(FRGUIPaneFactory.createRightZeroLayout());
tooltipTextField.setPreferredSize(NORMAL_DIMENSION);
tooltipTextFieldPane.add(tooltipTextField);
Component[][] downComponent = new Component[][]{
new Component[]{null, null},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Show_Content"), SwingConstants.LEFT), showContentPane},
new Component[]{fileNamePane, null},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_CellWrite_ToolTip"), SwingConstants.LEFT), tooltipTextFieldPane},
new Component[]{null, null},
new Component[]{null, null},
};
JPanel downPane = TableLayoutHelper.createGapTableLayoutPane(downComponent, downRowSize, downColumnSize, downRowCount, LayoutConstants.VGAP_LARGE, LayoutConstants.VGAP_MEDIUM);
JPanel pane = new JPanel(new BorderLayout());
pane.add(upPane, BorderLayout.NORTH);
pane.add(downPane, BorderLayout.CENTER);
return pane;
return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_MEDIUM, LayoutConstants.VGAP_LARGE);
}
private JPanel pagePane() {
@ -391,10 +412,10 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
insertRowLayout.show(insertRowPane, "none");
insertRowPane.setPreferredSize(new Dimension(0, 0));
}
southContentPane.setVisible(true);
insertRowPolicyPane.setVisible(true);
JTemplate jTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
if (!jTemplate.isJWorkBook()) { //表单中报表块编辑屏蔽掉 插入行策略
southContentPane.setVisible(false);
insertRowPolicyPane.setVisible(false);
}
}

31
designer-realize/src/main/java/com/fr/design/mainframe/errorinfo/ErrorInfoUploader.java

@ -8,6 +8,7 @@ import com.fr.general.GeneralContext;
import com.fr.general.IOUtils;
import com.fr.general.http.HttpResponseType;
import com.fr.general.http.HttpToolbox;
import com.fr.json.JSONArray;
import com.fr.json.JSONObject;
import com.fr.license.function.VT4FR;
import com.fr.log.FineLoggerFactory;
@ -21,7 +22,9 @@ import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
/**
* Created by Administrator on 2017/7/24 0024.
@ -35,6 +38,9 @@ public class ErrorInfoUploader {
// 在一台不能上网的电脑里发现了10w个errorinfo...
private static final int MAX_ERROR_SIZE = 2000;
//单次发送的错误信息最大条数
private static final int MAX_ITEMS = 200;
static {
GeneralContext.addEnvChangedListener(new EnvChangedListener() {
@Override
@ -142,21 +148,28 @@ public class ErrorInfoUploader {
try {
if (ArrayUtils.isNotEmpty(files)) {
JSONArray jsonArray = new JSONArray();
List<File> tempFiles = new ArrayList<>();
int count = 0;
for (File file : files) {
count++;
String filePath = file.getPath();
String suffix = filePath.substring(filePath.lastIndexOf("."));
if (suffix.endsWith(SUFFIX)) {
Thread.sleep(1000L);
String content = IOUtils.inputStream2String(new FileInputStream(file));
if (content.length() > MAX_ERROR_SIZE) {
CommonIOUtils.deleteFile(file);
continue;
}
String url = CloudCenter.getInstance().acquireUrlByKind("design.error");
if (sendErrorInfo(url, content)) {
CommonIOUtils.deleteFile(file);
jsonArray.put(new JSONObject(content));
tempFiles.add(file);
if( jsonArray.length() == MAX_ITEMS || count == files.length){
String url = CloudCenter.getInstance().acquireUrlByKind("design.error");
if(sendErrorInfo(url, jsonArray)){
deleteFiles(tempFiles);
}
jsonArray = new JSONArray();
}
}
}
@ -166,7 +179,13 @@ public class ErrorInfoUploader {
}
}
private boolean sendErrorInfo(String url, String content) {
private void deleteFiles(List<File> files) {
for(File file : files) {
CommonIOUtils.deleteFile(file);
}
}
private boolean sendErrorInfo(String url, JSONArray content) {
HashMap<String, Object> para = new HashMap<>();
para.put("token", SiteCenterToken.generateToken());
para.put("content", content);

134
designer-realize/src/main/java/com/fr/design/report/WriteShortCutsPane.java

@ -6,16 +6,26 @@ import com.fr.config.ServerPreferenceConfig;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.utils.gui.UIComponentUtils;
import com.fr.general.ComparatorUtils;
import javax.swing.*;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.GridLayout;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class WriteShortCutsPane extends JPanel{
private static final int V_GAP = 20;
private static final int MAX_LABEL_WIDTH = 100;
private String nextColString = "Tab";
private String nextRowString = "Enter";
private UILabel nextColHK;
@ -24,9 +34,8 @@ public class WriteShortCutsPane extends JPanel{
private UILabel preRow;
public WriteShortCutsPane(){
this.setLayout(null);
this.add(getFeatureNamePane());
this.add(getHintsPane());
this.setLayout(new BorderLayout());
this.add(createContentPane(), BorderLayout.NORTH);
if(!ServerPreferenceConfig.getInstance().isWriteShortCuts()){
nextColString = "Enter";
@ -34,64 +43,91 @@ public class WriteShortCutsPane extends JPanel{
switchColRow();
}
}
private JPanel createContentPane() {
JPanel contentPane = new JPanel();
contentPane.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 10));
// 纵向布局,横向自适应
contentPane.setLayout(new GridBagLayout());
GridBagConstraints cons = new GridBagConstraints();
cons.fill = GridBagConstraints.HORIZONTAL;
cons.weightx = 1;
cons.gridx = 0;
cons.insets = new Insets(20, 0, 0, 0);
contentPane.add(getFeatureNamePane(), cons);
contentPane.add(getHintsPane(), cons);
return contentPane;
}
//todo:布局不要用绝对定位
public JPanel getFeatureNamePane(){
JPanel panel1 = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
panel1.setBounds(20, 20, 600, 140);
panel1.setLayout(null);
panel1.setBorder(BorderFactory.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Shortcut_Set")));
private JPanel getFeatureNamePane(){
JPanel featureNamePane = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Shortcut_Set"));
featureNamePane.setLayout(new BorderLayout());
UILabel name = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Feature_Name"), SwingConstants.CENTER);
name.setBounds(40, 30, 80, 50);
UILabel nextCol = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Cursor_To_Next_Column"), SwingConstants.CENTER);
nextCol.setBounds(140, 30, 180, 50);
UILabel nextRow = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Cursor_To_Next_Row"), SwingConstants.CENTER);
nextRow.setBounds(390, 30, 180, 50);
UILabel shortName = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Current_Keys"), SwingConstants.CENTER);
shortName.setBounds(40, 80, 80, 50);
UIComponentUtils.setLineWrap(shortName, MAX_LABEL_WIDTH);
nextColHK = new UILabel(nextColString, SwingConstants.CENTER);
nextColHK.setBounds(140, 80, 180, 50);
UIButton switchbt = new UIButton(BaseUtils.readIcon("com/fr/design/images/buttonicon/switchShortCuts.png"));
switchbt.addActionListener(getListener());
switchbt.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Exchange_Key"));
switchbt.setBounds(337, 90, 36, 29);
JPanel switchBtnPane = getSwitchBtnPane();
nextRowHK = new UILabel(nextRowString, SwingConstants.CENTER);
nextRowHK.setBounds(390, 80, 180, 50);
panel1.add(name);
panel1.add(nextCol);
panel1.add(nextRow);
panel1.add(shortName);
panel1.add(nextColHK);
panel1.add(switchbt);
panel1.add(nextRowHK);
JPanel centerPane = new JPanel(new GridLayout(2, 4, 0, 0));
centerPane.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0));
centerPane.add(name);
centerPane.add(nextCol);
centerPane.add(new JPanel());
centerPane.add(nextRow);
centerPane.add(shortName);
centerPane.add(nextColHK);
centerPane.add(switchBtnPane);
centerPane.add(nextRowHK);
featureNamePane.add(centerPane, BorderLayout.CENTER);
return panel1;
return featureNamePane;
}
public JPanel getHintsPane(){
JPanel panel2 =FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
panel2.setBounds(20, 170, 600, 150);
panel2.setLayout(null);
panel2.setBorder(BorderFactory.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tool_Tips")));
private JPanel getSwitchBtnPane() {
UIButton switchbt = new UIButton(BaseUtils.readIcon("com/fr/design/images/buttonicon/switchShortCuts.png")) {
public Dimension getPreferredSize() {
return new Dimension(40, 30);
}
};
switchbt.addActionListener(getListener());
switchbt.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Exchange_Key"));
JPanel switchBtnPane = FRGUIPaneFactory.createCenterFlowInnerContainer_S_Pane();
switchBtnPane.add(switchbt);
return switchBtnPane;
}
private JPanel getHintsPane(){
JPanel hintsPane = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"));
hintsPane.setLayout(new BorderLayout());
UILabel systemDefault = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_System_Default"), SwingConstants.CENTER);
systemDefault.setBounds(38, 30, 84, 50);
UILabel preColText = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Cursor_To_Previous_Column"), SwingConstants.CENTER);
preColText.setBounds(140, 30, 190, 50);
UILabel preRowText = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Cursor_To_Previous_Row"), SwingConstants.CENTER);
preRowText.setBounds(140, 80, 190, 50);
preCol = new UILabel("Shift+" + nextColString, SwingConstants.CENTER);
preCol.setBounds(370, 30, 100, 50);
preRow = new UILabel("Shift+" + nextRowString, SwingConstants.CENTER);
preRow.setBounds(370, 80, 100, 50);
panel2.add(systemDefault);
panel2.add(preColText);
panel2.add(preRowText);
panel2.add(preCol);
panel2.add(preRow);
JPanel centerPane = new JPanel(new GridLayout(2, 3, 0, V_GAP));
centerPane.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 100));
centerPane.add(systemDefault);
centerPane.add(preColText);
centerPane.add(preCol);
centerPane.add(new JPanel());
centerPane.add(preRowText);
centerPane.add(preRow);
hintsPane.add(centerPane, BorderLayout.CENTER);
return panel2;
return hintsPane;
}
public ActionListener getListener(){

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

@ -513,6 +513,12 @@ public class EditToolBar extends BasicPane {
javaScriptPane.setPreferredSize(new Dimension(750, 500));
BasicDialog dialog = javaScriptPane.showWindow(SwingUtilities.getWindowAncestor(ButtonPane.this));
dialog.addDialogActionListener(new DialogActionAdapter() {
@Override
public void doCancel() {
javaScriptPane.populateBean(((CustomToolBarButton) widget).getJSImpl());
}
@Override
public void doOk() {
((CustomToolBarButton) widget).setJSImpl(javaScriptPane.updateBean());
@ -619,7 +625,7 @@ public class EditToolBar extends BasicPane {
} else if (widget instanceof Submit) {
updateSubmit();
} else if (widget instanceof CustomToolBarButton) {
((CustomToolBarButton) widget).setJSImpl(this.javaScriptPane.updateBean());
updateCustomToolBarButton();
} else if (widget instanceof Email) {
updateEmail();
}
@ -670,6 +676,16 @@ public class EditToolBar extends BasicPane {
email.setConsigneeByDepartment(this.consigneeByDepartment.isSelected());
email.setConsigneeByRole(this.consigneeByRole.isSelected());
}
private void updateCustomToolBarButton() {
CustomToolBarButton customToolBarButton = (CustomToolBarButton) widget;
if (customToolBarButton.getJSImpl() != null) {
customToolBarButton.setJSImpl(this.javaScriptPane.updateBean());
} else {
customToolBarButton.setJSImpl(JavaScriptActionPane.createDefault().updateBean());
}
}
}
}

39
designer-realize/src/main/java/com/fr/design/webattr/ToolBarDragPane.java

@ -10,16 +10,26 @@ import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.form.ui.Widget;
import com.fr.report.web.Location;
import com.fr.report.web.ToolBarManager;
import com.fr.stable.ArrayUtils;
import com.fr.stable.GraphDrawHelper;
import com.fr.stable.StringUtils;
import javax.swing.*;
import javax.swing.Icon;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.ListSelectionModel;
import javax.swing.SwingUtilities;
import javax.swing.table.DefaultTableCellRenderer;
import javax.swing.table.DefaultTableModel;
import java.awt.*;
import javax.swing.table.TableColumnModel;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
@ -34,6 +44,7 @@ import java.awt.image.ImageObserver;
public class ToolBarDragPane extends WidgetToolBarPane {
private static final int COLUMN = 4;
private static final int MIN_COLUMN_WIDTH = 15;
private int row = 7;
private DefaultTableModel toolbarButtonTableModel;
private JTable layoutTable;
@ -169,10 +180,6 @@ public class ToolBarDragPane extends WidgetToolBarPane {
layoutTable.setColumnSelectionAllowed(false);
layoutTable.setRowSelectionAllowed(false);
layoutTable.setBackground(Color.WHITE);
int columnWidth = Integer.parseInt(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Layout_Table_Column_Width"));
for (int i = 0; i < layoutTable.getColumnModel().getColumnCount(); i++) {
layoutTable.getColumnModel().getColumn(i).setPreferredWidth(columnWidth);
}
layoutTable.addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent e) {
if (e.getClickCount() > 1 && !(SwingUtilities.isRightMouseButton(e)) && isEnabled) {
@ -188,6 +195,23 @@ public class ToolBarDragPane extends WidgetToolBarPane {
});
}
// 根据控件名称长度,设置合适的列宽
private static void resizeColumnWidth(JTable table) {
final TableColumnModel columnModel = table.getColumnModel();
for (int column = 0; column < table.getColumnCount(); column++) {
int width = MIN_COLUMN_WIDTH; // Min width
for (int row = 0; row < table.getRowCount(); row++) {
WidgetOption widgetOption = (WidgetOption) table.getValueAt(row, column);
if (widgetOption == null) {
continue;
}
String optionName = widgetOption.optionName();
width = Math.max(GraphDrawHelper.getWidth(optionName), width);
}
columnModel.getColumn(column).setPreferredWidth(width);
}
}
private boolean isSelectedtable() {
for (int i = 0; i < layoutTable.getColumnCount(); i++) {
@ -229,6 +253,7 @@ public class ToolBarDragPane extends WidgetToolBarPane {
toolbarButtonTableModel.setValueAt(buttonArray[i], i % row, i / row);
}
}
resizeColumnWidth(layoutTable);
}

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

@ -6,6 +6,7 @@ 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.mainframe.DesignerContext;
import com.fr.design.utils.gui.UIComponentUtils;
import com.fr.file.FILE;
import com.fr.file.FILEChooserPane;
import com.fr.file.filter.ChooseFileFilter;
@ -46,6 +47,7 @@ public class WebCssPane extends BasicPane {
northPane.add(chooseFile, FlowLayout.RIGHT);
outnorth.add(northPane,BorderLayout.NORTH);
UILabel infor = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_CSS_Warning"));
UIComponentUtils.setLineWrap(infor);
infor.setForeground(new Color(207, 42, 39));
outnorth.add(infor,BorderLayout.CENTER);
this.add(outnorth, BorderLayout.NORTH);

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

@ -8,6 +8,7 @@ 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.mainframe.DesignerContext;
import com.fr.design.utils.gui.UIComponentUtils;
import com.fr.file.FILE;
import com.fr.file.FILEChooserPane;
import com.fr.file.filter.ChooseFileFilter;
@ -96,6 +97,7 @@ public class WebJsPane extends BasicPane {
northPane.add(chooseFile);
firstnorth.add(northPane,BorderLayout.NORTH);
infor1 = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_JS_WARNING1"));
UIComponentUtils.setLineWrap(infor1);
infor1.setForeground(new Color(207, 42, 39));
firstnorth.add(infor1,BorderLayout.CENTER);

10
designer-realize/src/main/java/com/fr/design/widget/ui/MultiFileEditorPane.java

@ -8,11 +8,14 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.utils.gui.UIComponentUtils;
import com.fr.form.ui.MultiFileEditor;
import javax.swing.*;
import java.awt.*;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
public class MultiFileEditorPane extends FieldEditorDefinePane<MultiFileEditor> {
private DictionaryComboBox acceptType;
@ -34,6 +37,7 @@ public class MultiFileEditorPane extends FieldEditorDefinePane<MultiFileEditor>
JPanel contenter = new JPanel(new BorderLayout());
singleFileCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Single_File_Upload"));
UIComponentUtils.setLineWrap(singleFileCheckBox);
singleFileCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
acceptType = new DictionaryComboBox(DictionaryConstants.acceptTypes, DictionaryConstants.fileTypeDisplays);
// acceptType.setPreferredSize(new Dimension(100, 20));

Loading…
Cancel
Save