Browse Source

Merge pull request #740 in DESIGN/design from ~PLOUGH/10-design:release/10.0 to release/10.0

* commit 'f5e0713b8bf22b4a633b003a7a63ecb48a10d76f':
  REPORT-14057 10.0日文国际化问题处理=>28 checkbox文字显示不全
  REPORT-14057 10.0日文国际化问题处理=>重构
  REPORT-14057 10.0日文国际化问题处理=>26 下拉框显示不全,相关问题
  REPORT-14057 10.0日文国际化问题处理=>简单重构
  REPORT-14057 10.0日文国际化问题处理=>26 下拉框显示不全
bugfix/10.0
plough 6 years ago
parent
commit
9013406655
  1. 16
      designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java
  2. 10
      designer-base/src/main/java/com/fr/design/gui/core/UITextComponent.java
  3. 35
      designer-base/src/main/java/com/fr/design/gui/ibutton/UIButton.java
  4. 3
      designer-base/src/main/java/com/fr/design/gui/ibutton/UIHeadGroup.java
  5. 3
      designer-base/src/main/java/com/fr/design/gui/icheckbox/UICheckBox.java
  6. 27
      designer-base/src/main/java/com/fr/design/gui/ilable/UILabel.java
  7. 3
      designer-base/src/main/java/com/fr/design/style/background/gradient/GradientBackgroundPane.java
  8. 51
      designer-base/src/main/java/com/fr/design/utils/gui/GUICoreUtils.java
  9. 51
      designer-base/src/main/java/com/fr/design/utils/gui/UIComponentUtils.java
  10. 109
      designer-base/src/test/java/com/fr/design/utils/gui/UIComponentUtilsTest.java
  11. 107
      designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellOtherSetPane.java
  12. 3
      designer-realize/src/main/java/com/fr/design/report/WriteShortCutsPane.java
  13. 3
      designer-realize/src/main/java/com/fr/design/webattr/WebCssPane.java
  14. 3
      designer-realize/src/main/java/com/fr/design/webattr/WebJsPane.java
  15. 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.layout.TableLayoutHelper;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.design.utils.gui.UIComponentUtils;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.FRFont; import com.fr.general.FRFont;
import com.fr.general.Inter; 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.Configurations;
import com.fr.transaction.Worker; import com.fr.transaction.Worker;
import javax.swing.*; import javax.swing.BorderFactory;
import java.awt.*; 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.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.awt.event.KeyAdapter; import java.awt.event.KeyAdapter;
@ -473,7 +483,7 @@ public class PreferencePane extends BasicPane {
JPanel memoryPane = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preference_Caching_Template")); 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 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")); UILabel memoryTipLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preference_Caching_Template_Tip"));
memoryTipLabel.setLineWrap(MEMORY_TIP_LABEL_MAX_WIDTH); UIComponentUtils.setLineWrap(memoryTipLabel, MEMORY_TIP_LABEL_MAX_WIDTH);
memoryTipLabel.setBorder(BorderFactory.createEmptyBorder(0, CACHING_GAP, 0, 0)); memoryTipLabel.setBorder(BorderFactory.createEmptyBorder(0, CACHING_GAP, 0, 0));
cachingTemplateSpinner = new UISpinner(0, CACHING_MAX, 1, CACHING_DEFAULT); cachingTemplateSpinner = new UISpinner(0, CACHING_MAX, 1, CACHING_DEFAULT);
JPanel memorySpace = new JPanel(FRGUIPaneFactory.createLeftZeroLayout()); JPanel memorySpace = new JPanel(FRGUIPaneFactory.createLeftZeroLayout());

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

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

@ -6,6 +6,7 @@ import com.fr.base.GraphHelper;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.event.UIObserver; import com.fr.design.event.UIObserver;
import com.fr.design.event.UIObserverListener; import com.fr.design.event.UIObserverListener;
import com.fr.design.gui.core.UITextComponent;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
@ -28,7 +29,7 @@ import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.awt.geom.RoundRectangle2D; 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 显示提示文字 private static final int TOOLTIP_INIT_DELAY = 300; // 延迟 0.3s 显示提示文字
public static final int OTHER_BORDER = 1; public static final int OTHER_BORDER = 1;
@ -49,7 +50,6 @@ public class UIButton extends JButton implements UIObserver {
private CellBorderStyle border = null; private CellBorderStyle border = null;
protected UIObserverListener uiObserverListener; protected UIObserverListener uiObserverListener;
private boolean fixedHeight = true; // 是否将按钮的高度固定为 HEIGHT
public UIButton() { public UIButton() {
this(StringUtils.EMPTY); this(StringUtils.EMPTY);
@ -340,36 +340,13 @@ public class UIButton extends JButton implements UIObserver {
this.isBorderPaintedOnlyWhenPressed = value; this.isBorderPaintedOnlyWhenPressed = value;
} }
/** private boolean isFixedHeight() {
* 到达指定宽度后换行
*/
public void setLineWrap(int width) {
insertPrefixToText("<html><body style='width: " + width + "px'>");
}
/**
* 自动换行
*/
public void setLineWrap() {
insertPrefixToText("<html><body>");
}
private void insertPrefixToText(String prefix) {
String text = this.getText(); String text = this.getText();
if (StringUtils.isEmpty(text)) { if (StringUtils.isEmpty(text)) {
return; return true;
} }
this.setText(prefix + text); // 如果允许换行,需要放开按钮高度的限制
// 如果文本过长,且允许换行的话,需要放开按钮高度的限制 return !text.startsWith("<html>");
this.setFixedHeight(false);
}
private boolean isFixedHeight() {
return fixedHeight;
}
private void setFixedHeight(boolean fixedHeight) {
this.fixedHeight = fixedHeight;
} }
/** /**

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

@ -3,6 +3,7 @@ package com.fr.design.gui.ibutton;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.design.utils.gui.UIComponentUtils;
import javax.swing.Icon; import javax.swing.Icon;
import javax.swing.JFrame; import javax.swing.JFrame;
@ -139,7 +140,7 @@ public class UIHeadGroup extends JPanel {
labelButton.setRoundBorder(false); labelButton.setRoundBorder(false);
labelButton.setBorderPainted(false); labelButton.setBorderPainted(false);
labelButton.setPressedPainted(false); labelButton.setPressedPainted(false);
labelButton.setLineWrap(); UIComponentUtils.setLineWrap(labelButton);
labelButtonList.add(labelButton); labelButtonList.add(labelButton);
this.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.GlobalNameObserver;
import com.fr.design.event.UIObserver; import com.fr.design.event.UIObserver;
import com.fr.design.event.UIObserverListener; import com.fr.design.event.UIObserverListener;
import com.fr.design.gui.core.UITextComponent;
import com.fr.design.utils.gui.GUIPaintUtils; import com.fr.design.utils.gui.GUIPaintUtils;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import sun.swing.SwingUtilities2; import sun.swing.SwingUtilities2;
@ -29,7 +30,7 @@ import java.awt.RenderingHints;
import java.awt.event.ItemEvent; import java.awt.event.ItemEvent;
import java.awt.event.ItemListener; 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 UIObserverListener uiObserverListener;
private GlobalNameListener globalNameListener = null; private GlobalNameListener globalNameListener = null;
private String checkboxName = ""; private String checkboxName = "";

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

@ -1,9 +1,9 @@
package com.fr.design.gui.ilable; package com.fr.design.gui.ilable;
import com.fr.design.gui.core.UITextComponent;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.StringUtils;
import javax.swing.Icon; import javax.swing.Icon;
import javax.swing.JFrame; import javax.swing.JFrame;
import javax.swing.JLabel; import javax.swing.JLabel;
@ -19,7 +19,7 @@ import java.awt.Dimension;
* Date: 13-1-23 * Date: 13-1-23
* Time: 下午3:15 * Time: 下午3:15
*/ */
public class UILabel extends JLabel { public class UILabel extends JLabel implements UITextComponent {
private static final int HTML_SHIFT_HEIGHT = 3; private static final int HTML_SHIFT_HEIGHT = 3;
public UILabel(String text, Icon image, int horizontalAlignment) { public UILabel(String text, Icon image, int horizontalAlignment) {
@ -64,29 +64,6 @@ public class UILabel extends JLabel {
return preferredSize; return preferredSize;
} }
/**
* 到达指定宽度后换行
*/
public void setLineWrap(int width) {
insertPrefixToText("<html><body style='width: " + width + "px'>");
}
/**
* 自动换行
*/
public void setLineWrap() {
insertPrefixToText("<html><body>");
}
private void insertPrefixToText(String prefix) {
String text = this.getText();
if (StringUtils.isEmpty(text)) {
return;
}
this.setText(prefix + text);
}
public static void main(String[] args) { public static void main(String[] args) {
// UILabel label = new UILabel("shishi",SwingConstants.LEFT); // UILabel label = new UILabel("shishi",SwingConstants.LEFT);
JFrame frame = new JFrame("Test"); JFrame frame = new JFrame("Test");

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

@ -5,6 +5,7 @@ import com.fr.design.gui.ibutton.UIRadioButton;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.style.background.BackgroundDetailPane; import com.fr.design.style.background.BackgroundDetailPane;
import com.fr.design.utils.gui.UIComponentUtils;
import com.fr.general.Background; import com.fr.general.Background;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
@ -43,7 +44,7 @@ public class GradientBackgroundPane extends BackgroundDetailPane {
blankJp.add(gradientBar); blankJp.add(gradientBar);
UILabel jl = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Drag_To_Select_Gradient")); 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)); jl.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 20));
jl.setLineWrap(); UIComponentUtils.setLineWrap(jl);
jl.setHorizontalAlignment(SwingConstants.CENTER); jl.setHorizontalAlignment(SwingConstants.CENTER);
gradientPanel.add(jl, BorderLayout.NORTH); gradientPanel.add(jl, BorderLayout.NORTH);
gradientPanel.add(blankJp, BorderLayout.SOUTH); 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.BaseUtils;
import com.fr.base.Style; import com.fr.base.Style;
import com.fr.base.background.ColorBackground; 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.UpdateAction;
import com.fr.design.actions.core.ActionFactory; import com.fr.design.actions.core.ActionFactory;
import com.fr.design.border.UITitledBorder; 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.ColorSelectBox;
import com.fr.design.style.color.ColorSelectable; import com.fr.design.style.color.ColorSelectable;
import com.fr.general.FRFont; import com.fr.general.FRFont;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import com.fr.stable.OperatingSystem; import com.fr.stable.OperatingSystem;
import com.fr.stable.StringUtils; 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.Border;
import javax.swing.border.LineBorder; import javax.swing.border.LineBorder;
import javax.swing.border.TitledBorder; import javax.swing.border.TitledBorder;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
import javax.swing.tree.TreeNode; import javax.swing.tree.TreeNode;
import javax.swing.tree.TreePath; import javax.swing.tree.TreePath;
import java.awt.BorderLayout;
import java.awt.*; 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.ActionListener;
import java.awt.event.ItemEvent; import java.awt.event.ItemEvent;
import java.awt.event.ItemListener; import java.awt.event.ItemListener;
@ -48,16 +82,17 @@ import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; 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 WINDOW_GAP = 20;
private static final int HEIGHT_GAP = 28; private static final int HEIGHT_GAP = 28;
private static final int WIN_LOCATION_Y=23; private static final int WIN_LOCATION_Y=23;
private static final int CASE_FOUR = 4; private static final int CASE_FOUR = 4;
// 覆盖缺省构造器,不可实例化
private GUICoreUtils() { 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());
}
}

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

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.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.*; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.layout.VerticalFlowLayout; import com.fr.design.layout.VerticalFlowLayout;
import com.fr.design.mainframe.EastRegionContainerPane; import com.fr.design.mainframe.EastRegionContainerPane;
import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplate;
import com.fr.design.utils.gui.UIComponentUtils;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.report.cell.DefaultTemplateCellElement; import com.fr.report.cell.DefaultTemplateCellElement;
import com.fr.report.cell.TemplateCellElement; import com.fr.report.cell.TemplateCellElement;
import com.fr.report.cell.cellattr.CellGUIAttr; 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.report.elementcase.TemplateElementCase;
import com.fr.stable.StringUtils; 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.ChangeEvent;
import javax.swing.event.ChangeListener; 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.ItemEvent;
import java.awt.event.ItemListener; 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_WDITH = 290;
private static final int HEAD_HEIGTH = 24; private static final int HEAD_HEIGTH = 24;
private static final Dimension NORMAL_DIMENSION = new Dimension(155, 20); private static final int COMBO_WIDTH = 154;
private static final Dimension SMALL_DIMENSION = new Dimension(150, 20);
// normal // normal
private UIButtonGroup autoshrik; private UIButtonGroup autoshrik;
@ -77,7 +85,7 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
private ValueEditorPane valueEditor; private ValueEditorPane valueEditor;
private CardLayout insertRowLayout; private CardLayout insertRowLayout;
private JPanel insertRowPane; private JPanel insertRowPane;
private JPanel southContentPane; private JPanel insertRowPolicyPane;
private JPanel defaultValuePane; private JPanel defaultValuePane;
/** /**
@ -129,6 +137,15 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
} }
private JPanel seniorPane() { 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"), 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")}); 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[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_CellWrite_InsertRow_Policy"), SwingConstants.LEFT), insertRowPolicy},
new Component[]{null, insertRowPane}, new Component[]{null, insertRowPane},
}; };
southContentPane = TableLayoutHelper.createGapTableLayoutPane(components1, rowSize1, columnSize1, rowCount1, LayoutConstants.VGAP_LARGE, LayoutConstants.VGAP_MEDIUM); insertRowPolicyPane = 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;
} }
private JPanel seniorUpPane() { 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(); 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); previewCellContent.setBorder(UIConstants.CELL_ATTR_ZEROBORDER);
printAndExportContent.setBorder(UIConstants.CELL_ATTR_ZEROBORDER); printAndExportContent.setBorder(UIConstants.CELL_ATTR_ZEROBORDER);
printAndExportBackground.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[]{printAndExportContent, null},
new Component[]{printAndExportBackground, null}, new Component[]{printAndExportBackground, null},
}; };
JPanel upPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_MEDIUM, LayoutConstants.VGAP_LARGE); return 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;
} }
private JPanel pagePane() { private JPanel pagePane() {
@ -391,10 +412,10 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
insertRowLayout.show(insertRowPane, "none"); insertRowLayout.show(insertRowPane, "none");
insertRowPane.setPreferredSize(new Dimension(0, 0)); insertRowPane.setPreferredSize(new Dimension(0, 0));
} }
southContentPane.setVisible(true); insertRowPolicyPane.setVisible(true);
JTemplate jTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); JTemplate jTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
if (!jTemplate.isJWorkBook()) { //表单中报表块编辑屏蔽掉 插入行策略 if (!jTemplate.isJWorkBook()) { //表单中报表块编辑屏蔽掉 插入行策略
southContentPane.setVisible(false); insertRowPolicyPane.setVisible(false);
} }
} }

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

@ -6,6 +6,7 @@ import com.fr.config.ServerPreferenceConfig;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.utils.gui.UIComponentUtils;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
@ -69,7 +70,7 @@ public class WriteShortCutsPane extends JPanel{
UILabel nextCol = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Cursor_To_Next_Column"), SwingConstants.CENTER); UILabel nextCol = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Cursor_To_Next_Column"), SwingConstants.CENTER);
UILabel nextRow = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Cursor_To_Next_Row"), SwingConstants.CENTER); UILabel nextRow = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Cursor_To_Next_Row"), SwingConstants.CENTER);
UILabel shortName = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Current_Keys"), SwingConstants.CENTER); UILabel shortName = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Current_Keys"), SwingConstants.CENTER);
shortName.setLineWrap(MAX_LABEL_WIDTH); UIComponentUtils.setLineWrap(shortName, MAX_LABEL_WIDTH);
nextColHK = new UILabel(nextColString, SwingConstants.CENTER); nextColHK = new UILabel(nextColString, SwingConstants.CENTER);
JPanel switchBtnPane = getSwitchBtnPane(); JPanel switchBtnPane = getSwitchBtnPane();
nextRowHK = new UILabel(nextRowString, SwingConstants.CENTER); nextRowHK = new UILabel(nextRowString, SwingConstants.CENTER);

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

3
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.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.utils.gui.UIComponentUtils;
import com.fr.file.FILE; import com.fr.file.FILE;
import com.fr.file.FILEChooserPane; import com.fr.file.FILEChooserPane;
import com.fr.file.filter.ChooseFileFilter; import com.fr.file.filter.ChooseFileFilter;
@ -96,7 +97,7 @@ public class WebJsPane extends BasicPane {
northPane.add(chooseFile); northPane.add(chooseFile);
firstnorth.add(northPane,BorderLayout.NORTH); firstnorth.add(northPane,BorderLayout.NORTH);
infor1 = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_JS_WARNING1")); infor1 = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_JS_WARNING1"));
infor1.setLineWrap(); UIComponentUtils.setLineWrap(infor1);
infor1.setForeground(new Color(207, 42, 39)); infor1.setForeground(new Color(207, 42, 39));
firstnorth.add(infor1,BorderLayout.CENTER); 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.gui.ispinner.UISpinner;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.utils.gui.UIComponentUtils;
import com.fr.form.ui.MultiFileEditor; import com.fr.form.ui.MultiFileEditor;
import javax.swing.BorderFactory;
import javax.swing.*; import javax.swing.JPanel;
import java.awt.*; import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
public class MultiFileEditorPane extends FieldEditorDefinePane<MultiFileEditor> { public class MultiFileEditorPane extends FieldEditorDefinePane<MultiFileEditor> {
private DictionaryComboBox acceptType; private DictionaryComboBox acceptType;
@ -34,6 +37,7 @@ public class MultiFileEditorPane extends FieldEditorDefinePane<MultiFileEditor>
JPanel contenter = new JPanel(new BorderLayout()); JPanel contenter = new JPanel(new BorderLayout());
singleFileCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Single_File_Upload")); 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)); singleFileCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
acceptType = new DictionaryComboBox(DictionaryConstants.acceptTypes, DictionaryConstants.fileTypeDisplays); acceptType = new DictionaryComboBox(DictionaryConstants.acceptTypes, DictionaryConstants.fileTypeDisplays);
// acceptType.setPreferredSize(new Dimension(100, 20)); // acceptType.setPreferredSize(new Dimension(100, 20));

Loading…
Cancel
Save