Browse Source

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

feature/big-screen
Qinghui.Liu 4 years ago
parent
commit
630d7e4058
  1. 12
      designer-base/src/main/java/com/fr/design/data/datapane/TableDataCreatorProducer.java
  2. 1
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/MaxMemRowCountPanel.java
  3. 29
      designer-base/src/main/java/com/fr/design/gui/ispinner/UISpinner.java
  4. 2
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java
  5. 5
      designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java
  6. 27
      designer-base/src/main/java/com/fr/design/utils/DesignUtils.java
  7. 8
      designer-chart/src/main/java/com/fr/van/chart/column/VanChartCustomStackAndAxisConditionPane.java
  8. 75
      designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/component/VanChartAxisButtonPane.java
  9. 2
      designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeCateOrPercentLabelDetailPane.java
  10. 6
      designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeLabelDetailPane.java
  11. 18
      designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java
  12. 7
      designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java
  13. 60
      designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java
  14. 10
      designer-form/src/main/java/com/fr/design/mainframe/FormDesignerUI.java
  15. 40
      designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileTabCommonSettingPane.java
  16. 5
      designer-realize/src/main/java/com/fr/design/cell/editor/RichTextToolBar.java
  17. 12
      designer-realize/src/main/java/com/fr/design/mainframe/JPolyWorkBook.java
  18. 14
      designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java
  19. 43
      designer-realize/src/main/java/com/fr/design/mainframe/PolySheetNameTabPane.java
  20. 69
      designer-realize/src/test/java/com/fr/design/cell/editor/RichTextToolBarTest.java

12
designer-base/src/main/java/com/fr/design/data/datapane/TableDataCreatorProducer.java

@ -72,24 +72,18 @@ public class TableDataCreatorProducer {
public TableDataNameObjectCreator[] createServerTableDataCreator() {
TableDataNameObjectCreator dataBase = new TableDataNameObjectCreator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_DS_Database_Query"),
"ds",
"/com/fr/design/images/data/dock/serverdatabase.png", DBTableData.class,
DBTableDataPane.class);
TableDataNameObjectCreator ds_Class = new TableDataNameObjectCreator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tabledata_Type_Class"),
"Class",
"/com/fr/design/images/data/dock/serverclasstabledata.png", ClassTableData.class,
ClassTableDataPane.class);
TableDataNameObjectCreator table = new TableDataNameObjectCreator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tabledata_Type_Embedded"),
"Embedded",
"/com/fr/design/images/data/dock/serverdatatable.png", EmbeddedTableData.class,
EmbeddedTableDataPane.class);
TableDataNameObjectCreator fileTable = new TableDataNameObjectCreator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tabledata_Type_File"),
"File",
"/com/fr/design/images/data/file.png", FileTableData.class,
FileTableDataSmallPane.class);
TableDataNameObjectCreator treeTable = new TableDataNameObjectCreator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tabledata_Type_Tree"),
"Tree",
"/com/fr/design/images/data/tree.png",
RecursionTableData.class, GlobalTreeTableDataPane.class) {
public boolean isNeedParameterWhenPopulateJControlPane() {
@ -97,7 +91,6 @@ public class TableDataCreatorProducer {
}
};
TableDataNameObjectCreator multiTable = new TableDataNameObjectCreator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tabledata_Type_Relation"),
"Multi",
"/com/fr/design/images/data/multi.png",
ConditionTableData.class, GlobalMultiTDTableDataPane.class) {
public boolean isNeedParameterWhenPopulateJControlPane() {
@ -105,7 +98,6 @@ public class TableDataCreatorProducer {
}
};
TableDataNameObjectCreator storeProcedure = new TableDataNameObjectCreator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tabledata_Type_Stored_Procedure"),
"Proc",
"/com/fr/design/images/data/store_procedure.png",
StoreProcedure.class, ProcedureDataPane.class) {
@Override
@ -113,9 +105,7 @@ public class TableDataCreatorProducer {
return true;
}
};
TableDataNameObjectCreator[] creators = new TableDataNameObjectCreator[]{dataBase, ds_Class, table, fileTable, storeProcedure, multiTable, treeTable};
return merge(creators, ExtraDesignClassManager.getInstance().getServerTableDataCreators());
}
@ -141,6 +131,6 @@ public class TableDataCreatorProducer {
for (int i = 0; i < coverIndexList.size(); i ++) {
creators[coverIndexList.get(i)] = coverCreators.get(i);
}
return (TableDataNameObjectCreator[])ArrayUtils.addAll(creators, list.toArray(new TableDataNameObjectCreator[list.size()]));
return ArrayUtils.addAll(creators, list.toArray(new TableDataNameObjectCreator[0]));
}
}

1
designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/MaxMemRowCountPanel.java

@ -73,6 +73,7 @@ public class MaxMemRowCountPanel extends UIToolbar {
switchCache = new UIComboBox(CACHE_LIST);
switchCache.addActionListener(switchStateL);
numberSpinner = new UISpinner(0, Integer.MAX_VALUE, 1);
numberSpinner.setNumberFieldColumns(4);
}
private void showAllPanel() {

29
designer-base/src/main/java/com/fr/design/gui/ispinner/UISpinner.java

@ -30,6 +30,7 @@ public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver
private static final int LEN = 13;
private static final int WIDTH = 13;
private static final int HEIGHT = 10;
private static final int DEFAULT_NUMBERFIELD_COLUMNS = 2;
private UINumberField textField;
private UIButton preButton;
private UIButton nextButton;
@ -40,9 +41,22 @@ public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver
private UIObserverListener uiObserverListener;
private GlobalNameListener globalNameListener = null;
private boolean lessMinValue = false;
/**
* Spinner内的数字文本框长度
*/
private int numberFieldColumns;
public UISpinner(double minValue, double maxValue, double dierta) {
init(minValue, maxValue, dierta);
}
public UISpinner(double minValue, double maxValue, double dierta, double defaultValue) {
init(minValue, maxValue, dierta);
textField.setValue(defaultValue);
}
private void init(double minValue, double maxValue, double dierta) {
this.minValue = minValue;
this.maxValue = maxValue;
this.dierta = dierta;
@ -50,11 +64,6 @@ public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver
iniListener();
}
public UISpinner(double minValue, double maxValue, double dierta, double defaultValue) {
this(minValue, maxValue, dierta);
textField.setValue(defaultValue);
}
private void iniListener() {
if (shouldResponseChangeListener()) {
this.addChangeListener(new ChangeListener() {
@ -156,6 +165,13 @@ public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver
fireStateChanged();
}
/**
* 设置Spinner内的数字输入框列数
* @param numberFieldColumns 输入框列数
*/
public void setNumberFieldColumns(int numberFieldColumns) {
textField.setColumns(numberFieldColumns);
}
public void setEnabled(boolean flag) {
super.setEnabled(flag);
@ -308,7 +324,8 @@ public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver
}
protected UINumberField initNumberField() {
return new UINumberField(2) {
int columns = this.numberFieldColumns == 0 ? DEFAULT_NUMBERFIELD_COLUMNS : this.numberFieldColumns;
return new UINumberField(columns) {
public boolean shouldResponseChangeListener() {
return false;
}

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

@ -556,7 +556,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
);
newNameLabel.setHorizontalAlignment(SwingConstants.RIGHT);
newNameLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 10));
newNameLabel.setPreferredSize(new Dimension(118, 15));
//newNameLabel.setPreferredSize(new Dimension(118, 15));
// 重命名输入框
nameField = new UITextField(oldName);

5
designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java

@ -511,7 +511,10 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
UIUtil.invokeLaterIfNeeded(new Runnable() {
@Override
public void run() {
propertyItemMap.get(key).replaceContentPane(pane);
PropertyItem item = propertyItemMap.get(key);
if (item != null) {
item.replaceContentPane(pane);
}
}
});
}

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

@ -19,10 +19,10 @@ import com.fr.stable.ArrayUtils;
import com.fr.stable.CommonCodeUtils;
import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils;
import com.fr.stable.os.OperatingSystem;
import com.fr.start.ServerStarter;
import com.fr.workspace.WorkContext;
import javax.swing.JOptionPane;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import java.awt.Desktop;
@ -31,7 +31,6 @@ import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
@ -83,6 +82,7 @@ public class DesignUtils {
/**
* 判断设计器端口是否被其他程序占用
* 尝试去通信无回应就是其他程序占用端口否则需要继续判断是否为设计器进程未关闭
*
* @return
*/
public static boolean isPortOccupied() {
@ -153,7 +153,7 @@ public class DesignUtils {
return;
}
try (Socket socket = new Socket("localhost", port)) {
clientSend(lines, socket);
clientSend(lines, socket);
} catch (Exception ignore) {
}
@ -189,10 +189,10 @@ public class DesignUtils {
DesignerEnvManager.getEnvManager().setCurrentEnv2Default();
ServerStarter.browserDemoURL();
} else if ("check".equals(line)) {
clientSend(new String[] {"response"}, socket);
clientSend(new String[]{"response"}, socket);
} else if ("end".equals(line)) {
DesignerExiter.getInstance().execute(); }
else if (StringUtils.isNotEmpty(line)) {
DesignerExiter.getInstance().execute();
} else if (StringUtils.isNotEmpty(line)) {
File f = new File(line);
String path = f.getAbsolutePath();
@ -219,7 +219,7 @@ public class DesignUtils {
}
public static void responseToClient(Socket socket) {
public static void responseToClient(Socket socket) {
try (OutputStream outputStream = socket.getOutputStream()) {
outputStream.write("reponse".getBytes(StandardCharsets.UTF_8));
outputStream.flush();
@ -285,13 +285,20 @@ public class DesignUtils {
return key.startsWith("TextField.") || key.startsWith("PasswordField.");
}
/**
* 获取当前系统语言下设计器用的默认字体
*
* @return 默认字体
*/
private static FRFont getCurrentLocaleFont() {
FRFont guiFRFont;
Locale defaultLocale = Locale.getDefault();
if (isDisplaySimSun(defaultLocale)) {
// JDK9 之后宋体在计算label中字母的空间上出现问题,暂时先用雅黑兼容,以后再统一字体
if (StableUtils.getMajorJavaVersion() >= 9 && OperatingSystem.isWindows()) {
guiFRFont = getNamedFont("Microsoft YaHei");
} else if (isDisplaySimSun(defaultLocale)) {
guiFRFont = getNamedFont("SimSun");
} else {
} else {
guiFRFont = getNamedFont("Dialog");
}

8
designer-chart/src/main/java/com/fr/van/chart/column/VanChartCustomStackAndAxisConditionPane.java

@ -6,18 +6,19 @@ import com.fr.data.condition.ListCondition;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.condition.LiteConditionPane;
import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.plugin.chart.base.AttrSeriesStackAndAxis;
import com.fr.van.chart.designer.style.series.VanChartSeriesConditionPane;
import javax.swing.BorderFactory;
import javax.swing.BoxLayout;
import javax.swing.JPanel;
import javax.swing.ScrollPaneConstants;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
@ -46,10 +47,13 @@ public class VanChartCustomStackAndAxisConditionPane extends BasicBeanPane<Condi
//配置界面
JPanel deployPane = FRGUIPaneFactory.createBorderLayout_L_Pane();
this.add(deployPane);
deployPane.setBorder(GUICoreUtils.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Deploy") + ":", null));
deployPane.add(createDeployPane());
UIScrollPane scrollPane = new UIScrollPane(deployPane);
scrollPane.setBorder(BorderFactory.createEmptyBorder());
scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
this.add(scrollPane);
//条件界面
JPanel conditionPane = FRGUIPaneFactory.createBorderLayout_L_Pane();

75
designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/component/VanChartAxisButtonPane.java

@ -8,7 +8,6 @@ import com.fr.design.gui.imenu.UIMenuItem;
import com.fr.design.gui.imenu.UIPopupMenu;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.ComparatorUtils;
import com.fr.plugin.chart.VanChartAttrHelper;
import com.fr.plugin.chart.attr.axis.VanChartAxis;
import com.fr.plugin.chart.attr.plot.VanChartAxisPlot;
@ -18,6 +17,8 @@ import javax.swing.BorderFactory;
import javax.swing.BoxLayout;
import javax.swing.Icon;
import javax.swing.JPanel;
import java.util.ArrayList;
import java.util.List;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.FlowLayout;
@ -29,8 +30,6 @@ import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.geom.Rectangle2D;
import java.awt.image.BufferedImage;
import java.util.ArrayList;
import java.util.List;
/**
* 坐标轴-上方按钮界面
@ -41,9 +40,12 @@ public class VanChartAxisButtonPane extends BasicBeanPane<VanChartAxisPlot> {
private static final int B_W = 56;
private static final int B_H = 21;
private static final int COL_COUNT = 3;
private static final int MAX_COUNT = 20;
private UIButton addButton;
private UIPopupMenu popupMenu;
private UIMenuItem itemX;
private UIMenuItem itemY;
private List<ChartAxisButton> indexList_X = new ArrayList<ChartAxisButton>();
private List<ChartAxisButton> indexList_Y = new ArrayList<ChartAxisButton>();
@ -51,7 +53,7 @@ public class VanChartAxisButtonPane extends BasicBeanPane<VanChartAxisPlot> {
private VanChartAxisPane parent;
public VanChartAxisButtonPane(VanChartAxisPane vanChartAxisPane){
public VanChartAxisButtonPane(VanChartAxisPane vanChartAxisPane) {
this.parent = vanChartAxisPane;
this.setLayout(new BorderLayout());
@ -66,6 +68,20 @@ public class VanChartAxisButtonPane extends BasicBeanPane<VanChartAxisPlot> {
buttonPane.setBorder(BorderFactory.createEmptyBorder(0, 5, 10, 0));
this.add(buttonPane, BorderLayout.CENTER);
itemX = new UIMenuItem(VanChartAttrHelper.X_AXIS_PREFIX);
itemX.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
addXAxis();
}
});
itemY = new UIMenuItem(VanChartAttrHelper.Y_AXIS_PREFIX);
itemY.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
addYAxis();
}
});
addButton.addActionListener(addListener);
}
@ -92,12 +108,12 @@ public class VanChartAxisButtonPane extends BasicBeanPane<VanChartAxisPlot> {
pane = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0));
buttonPane.add(pane);
}
if(pane != null) {
if (pane != null) {
pane.add(indexList_Y.get(i));
}
}
if(popupMenu != null){
if (popupMenu != null) {
popupMenu.setVisible(false);
}
@ -114,19 +130,19 @@ public class VanChartAxisButtonPane extends BasicBeanPane<VanChartAxisPlot> {
indexList_X.clear();
indexList_Y.clear();
List<VanChartAxis> xList = plot.getXAxisList();
for(VanChartAxis axis : xList){
for (VanChartAxis axis : xList) {
ChartAxisButton x = new ChartAxisButton(plot.getXAxisName(axis));
x.setToolTipText(plot.getXAxisName(axis));
indexList_X.add(x);
}
List<VanChartAxis> yList = plot.getYAxisList();
for(VanChartAxis axis : yList){
for (VanChartAxis axis : yList) {
ChartAxisButton y = new ChartAxisButton(plot.getYAxisName(axis));
y.setToolTipText(plot.getYAxisName(axis));
indexList_Y.add(y);
}
if(indexList_X.isEmpty()){
if (indexList_X.isEmpty()) {
this.removeAll();
} else {
indexList_X.get(0).setSelected(true);
@ -143,7 +159,7 @@ public class VanChartAxisButtonPane extends BasicBeanPane<VanChartAxisPlot> {
return null;
}
public String getNewChartName(List<ChartAxisButton> existList, String prefix){
public String getNewChartName(List<ChartAxisButton> existList, String prefix) {
int count = existList.size() + 1;
while (true) {
String name_test = prefix + count;
@ -165,31 +181,19 @@ public class VanChartAxisButtonPane extends BasicBeanPane<VanChartAxisPlot> {
ActionListener addListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if(popupMenu == null){
popupMenu = new UIPopupMenu();
UIMenuItem item_x = new UIMenuItem(VanChartAttrHelper.X_AXIS_PREFIX);
item_x.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
addXAxis();
}
});
UIMenuItem item_y = new UIMenuItem(VanChartAttrHelper.Y_AXIS_PREFIX);
item_y.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
addYAxis();
}
});
popupMenu.add(item_x);
popupMenu.add(item_y);
popupMenu = new UIPopupMenu();
if (indexList_X.size() < MAX_COUNT) {
popupMenu.add(itemX);
}
if (indexList_Y.size() < MAX_COUNT) {
popupMenu.add(itemY);
}
popupMenu.setVisible(true);
GUICoreUtils.showPopupMenu(popupMenu, addButton, addButton.getWidth() - popupMenu.getPreferredSize().width, addButton.getY() - 1 + addButton.getHeight());
}
};
private void addXAxis(){
private void addXAxis() {
String name = getNewChartName(indexList_X, VanChartAttrHelper.X_AXIS_PREFIX);
ChartAxisButton button = new ChartAxisButton(name);
@ -199,7 +203,7 @@ public class VanChartAxisButtonPane extends BasicBeanPane<VanChartAxisPlot> {
layoutPane();
}
private void addYAxis(){
private void addYAxis() {
String name = getNewChartName(indexList_Y, VanChartAttrHelper.Y_AXIS_PREFIX);
ChartAxisButton button = new ChartAxisButton(name);
@ -216,9 +220,10 @@ public class VanChartAxisButtonPane extends BasicBeanPane<VanChartAxisPlot> {
private class AddButton extends UIButton {
public AddButton(Icon icon){
public AddButton(Icon icon) {
super(icon);
}
/**
* 组件是否需要响应添加的观察者事件
*
@ -277,19 +282,19 @@ public class VanChartAxisButtonPane extends BasicBeanPane<VanChartAxisPlot> {
}
private void noSelected() {
for(ChartAxisButton button : indexList_X){
for (ChartAxisButton button : indexList_X) {
button.setSelected(false);
}
for(ChartAxisButton button : indexList_Y){
for (ChartAxisButton button : indexList_Y) {
button.setSelected(false);
}
}
private void checkMoveOn(boolean moveOn) {
for(ChartAxisButton button : indexList_X){
for (ChartAxisButton button : indexList_X) {
button.isMoveOn = false;
}
for(ChartAxisButton button : indexList_Y){
for (ChartAxisButton button : indexList_Y) {
button.isMoveOn = false;
}

2
designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeCateOrPercentLabelDetailPane.java

@ -22,7 +22,7 @@ public class VanChartGaugeCateOrPercentLabelDetailPane extends VanChartGaugeLabe
}
protected double[] getLabelPaneRowSize(Plot plot, double p) {
if (hasLabelAlign(plot)) {
if (hasLabelAlignPane()) {
return new double[]{p, p, p, p};
}

6
designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeLabelDetailPane.java

@ -124,7 +124,7 @@ public class VanChartGaugeLabelDetailPane extends VanChartPlotLabelDetailPane {
}
protected Component[][] getLabelPaneComponents(Plot plot, double p, double[] columnSize) {
if (hasLabelAlign(plot)) {
if (hasLabelAlignPane()) {
return new Component[][]{
new Component[]{getDataLabelContentPane(), null},
@ -223,6 +223,10 @@ public class VanChartGaugeLabelDetailPane extends VanChartPlotLabelDetailPane {
return getGaugeStyle() == GaugeStyle.THERMOMETER && !((VanChartGaugePlot) plot).getGaugeDetailStyle().isHorizontalLayout();
}
protected boolean hasLabelAlignPane() {
return getGaugeStyle() == GaugeStyle.THERMOMETER;
}
public void populate(AttrLabelDetail detail) {
super.populate(detail);

18
designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java

@ -3,6 +3,7 @@
*/
package com.fr.design.designer.beans.adapters.layout;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.beans.GroupModel;
import com.fr.design.designer.beans.ConstraintsGroupModel;
import com.fr.design.designer.beans.HoverPainter;
@ -18,6 +19,7 @@ import com.fr.design.designer.creator.cardlayout.XWCardTitleLayout;
import com.fr.design.designer.creator.cardlayout.XWTabFitLayout;
import com.fr.design.designer.properties.FRFitLayoutConstraints;
import com.fr.design.designer.properties.FRFitLayoutPropertiesGroupModel;
import com.fr.design.fun.FormWidgetOptionProvider;
import com.fr.design.utils.ComponentUtils;
import com.fr.form.ui.LayoutBorderStyle;
import com.fr.form.ui.container.WAbsoluteLayout;
@ -32,6 +34,7 @@ import java.awt.Dimension;
import java.awt.Rectangle;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
/**
* 自适应布局的容器适配器
@ -161,7 +164,8 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter {
//布局控件要先判断是不是可编辑
XLayoutContainer topLayout = XCreatorUtils.getHotspotContainer((XCreator) comp).getTopLayout();
if (topLayout != null && !isMatchEdge && !topLayout.isEditable() && !topLayout.acceptType(XWAbsoluteLayout.class)) {
boolean access = topLayout != null && !isMatchEdge && !topLayout.isEditable() && !topLayout.acceptType(XWAbsoluteLayout.class) && !isExtraContainer(comp);
if (access) {
return false;
}
@ -178,6 +182,18 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter {
return y > upHeight && y < downHeight ? horizonValid : verticalValid;
}
private boolean isExtraContainer(Component comp) {
if (container != null) {
Set<FormWidgetOptionProvider> set = ExtraDesignClassManager.getInstance().getArray(FormWidgetOptionProvider.XML_TAG);
for (FormWidgetOptionProvider provider : set) {
if (provider.isContainer() && ComparatorUtils.equals(provider.appearanceForWidget(), comp.getClass())) {
return true;
}
}
}
return false;
}
// 间隔区域
private boolean checkInterval(Component comp) {
return container.getComponentCount() > 0 && comp == container;

7
designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java

@ -345,17 +345,16 @@ public class XCreatorUtils {
}
/**
* 获取组件的最顶层XMainBorderLayout,没有则返回null
* 获取组件的上一层的XMainBorderLayout,没有则返回null
* */
@Nullable
public static XWCardMainBorderLayout getTopXMainBorderLayout(Container creator) {
XWCardMainBorderLayout result = null;
while (creator != null) {
if (creator instanceof XWCardMainBorderLayout) {
result = (XWCardMainBorderLayout) creator;
return (XWCardMainBorderLayout) creator;
}
creator = creator.getParent();
}
return result;
return null;
}
}

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

@ -189,7 +189,6 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
this.switchAction = switchAction;
topXCreators=new TopXCreators(this);
topXCreators.setVisible(true);
add(topXCreators);
// 必须刷新"参数/控件树"面板,否则,若最近一次打开模版为 cpt,重启设计器,打开 frm,控件树消失
populateParameterPropertyPane();
@ -843,26 +842,61 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
if (shouldContinue) {
continue;
}
//如果组件为XWCardMainBorderLayout的子组件,直接从XWCardMainBorderLayout中去找
XWCardMainBorderLayout borderLayout = XCreatorUtils.getTopXMainBorderLayout(creator);
if (borderLayout != null) {
return xCreatorAt(x, y, borderLayout, null);
//获取当前组件父组件相对于rootComponent或者paraComponent的距离
int relativeParentX = getRelativeParentX(creator.getParent());
int relativeParentY = getRelativeParentY(creator.getParent());
//如果不是布局容器,直接进行对比
if (!(creator instanceof XLayoutContainer)) {
int newX = x - relativeParentX - creator.getX();
int newY = y - relativeParentY - creator.getY();
Rectangle rect = ComponentUtils.computeVisibleRect(creator);
// 判断是否处于交叉区域
if (isIntersectArea(newX, newY, rect)) {
return creator;
}
}
//如果是布局容器,从布局容器向下找
if (creator instanceof XLayoutContainer) {
return xCreatorAt(x, y, creator, null);
XCreator result = xCreatorAt(x - relativeParentX, y - relativeParentY, creator, null);
if (result != null) {
return result;
}
}
x -= creator.getX();
y -= creator.getY();
Rectangle rect = ComponentUtils.computeVisibleRect(creator);
// 判断是否处于交叉区域
if (!isIntersectArea(x, y, rect)) {
continue;
//最后,如果组件为Tab容器中的子组件,再从Tab容器中去找
XWCardMainBorderLayout borderLayout = XCreatorUtils.getTopXMainBorderLayout(creator);
if (borderLayout != null) {
relativeParentX = getRelativeParentX(borderLayout.getParent());
relativeParentY = getRelativeParentY(borderLayout.getParent());
return xCreatorAt(x - relativeParentX, y - relativeParentY, borderLayout, null);
}
return creator;
}
return null;
}
/**
* 获取当前组件相对于rootComponent或者paraComponent的横向距离
*/
private int getRelativeParentX(Container container) {
return returnZero(container) ? 0 : container.getX() + getRelativeParentX(container.getParent());
}
/**
* 获取当前组件相对于rootComponent或者paraComponent的纵向距离
*/
private int getRelativeParentY(Container container) {
return returnZero(container) ? 0 : container.getY() + getRelativeParentY(container.getParent());
}
private boolean returnZero(Container container) {
return !(container instanceof XLayoutContainer)
|| container == rootComponent
|| (paraComponent != null && container == paraComponent);
}
/**
* 刷新顶层组件
* */

10
designer-form/src/main/java/com/fr/design/mainframe/FormDesignerUI.java

@ -84,7 +84,7 @@ public class FormDesignerUI extends ComponentUI {
// 设计参数面板
repaintPara(g, paraComponent, c);
}
repaintTopXCreators(g);
paintTopXCreators(g);
if (designer.isDrawLineMode() && designer.getDrawLineHelper().drawLining()) {
designer.getDrawLineHelper().drawAuxiliaryLine(g);
@ -410,8 +410,8 @@ public class FormDesignerUI extends ComponentUI {
clipg = g.create(
-designer.getHorizontalScaleValue(),
-designer.getVerticalScaleValue() + designer.getParaHeight(),
parent.getSize().width + designer.getHorizontalScaleValue(),
parent.getSize().height + designer.getVerticalScaleValue());
component.getSize().width + designer.getHorizontalScaleValue(),
component.getSize().height + designer.getVerticalScaleValue());
designer.paintContent(clipg);
paintWatermark((Graphics2D) clipg);
@ -436,7 +436,7 @@ public class FormDesignerUI extends ComponentUI {
Graphics clipg1;
clipg1 = g.create(-designer.getHorizontalScaleValue(),
-designer.getVerticalScaleValue(),
parent.getSize().width + designer.getHorizontalScaleValue(),
component.getSize().width + designer.getHorizontalScaleValue(),
designer.getParaHeight() + designer.getVerticalScaleValue());
designer.paintPara(clipg1);
@ -446,7 +446,7 @@ public class FormDesignerUI extends ComponentUI {
ComponentUtils.resetBuffer(dbcomponents);
}
private void repaintTopXCreators(Graphics g){
private void paintTopXCreators(Graphics g){
designer.paintTopCreators(g);
}

40
designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileTabCommonSettingPane.java

@ -112,20 +112,10 @@ public class MobileTabCommonSettingPane extends BasicPane {
JPanel selectDotColorPane = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{selectColor, selectDotColorBox}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_MEDIUM);
double[] rowSize = {TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED};
double[] columnSize = {TableLayout.FILL};
int[][] rowCount = {{1}, {1}, {1}};
double[] verticalGaps = {10, 10, 10};
double[] verticalGaps = {IntervalConstants.INTERVAL_L1, IntervalConstants.INTERVAL_L1, IntervalConstants.INTERVAL_L1};
double[] dotSettingColumnSize = {TableLayout.PREFERRED, TableLayout.FILL};
Component[][] components = new Component[][]{
new Component[]{this.showTabTitleCheck},
new Component[]{this.tabSlideCheck},
new Component[]{this.showTabDotIndicatorCheck}
};
JPanel tabBaseConfigPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount,
IntervalConstants.INTERVAL_L1, IntervalConstants.INTERVAL_L1);
tabBaseConfigPane.setBorder(BorderFactory.createEmptyBorder(0, 0, IntervalConstants.INTERVAL_L1, 0));
final JPanel tabBaseConfigPanel = createTableConfigJPanel();
JPanel dotIndicatorSettingPanel = TableLayoutHelper.createDiffVGapTableLayoutPane(new JComponent[][]{
{label, dotIndicatorShowTypePane},
@ -135,11 +125,18 @@ public class MobileTabCommonSettingPane extends BasicPane {
BorderFactory.createEmptyBorder(0, IntervalConstants.INTERVAL_L2, IntervalConstants.INTERVAL_L1, 0)
);
final JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane();
jPanel.add(tabBaseConfigPane, BorderLayout.NORTH);
jPanel.add(dotIndicatorSettingPanel, BorderLayout.CENTER);
final JPanel tableConfigJPanel = FRGUIPaneFactory.createBorderLayout_S_Pane();
tableConfigJPanel.add(tabBaseConfigPanel, BorderLayout.NORTH);
tableConfigJPanel.add(dotIndicatorSettingPanel, BorderLayout.CENTER);
this.add(tableConfigJPanel, BorderLayout.CENTER);
this.add(jPanel, BorderLayout.CENTER);
tabSlideCheck.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
showTabDotIndicatorCheck.setVisible(tabSlideCheck.isSelected());
dotIndicatorSettingPanel.setVisible(tabSlideCheck.isSelected() && showTabDotIndicatorCheck.isSelected());
}
});
showTabDotIndicatorCheck.addChangeListener(new ChangeListener() {
@Override
@ -200,4 +197,15 @@ public class MobileTabCommonSettingPane extends BasicPane {
colorBox.setSelectObject(color);
}
}
private JPanel createTableConfigJPanel() {
final JPanel jPanel = new JPanel();
BorderLayout borderLayout = new BorderLayout(0, IntervalConstants.INTERVAL_L1);
jPanel.setLayout(borderLayout);
jPanel.add(this.showTabTitleCheck, BorderLayout.NORTH);
jPanel.add(this.tabSlideCheck, BorderLayout.CENTER);
jPanel.add(this.showTabDotIndicatorCheck, BorderLayout.SOUTH);
jPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, IntervalConstants.INTERVAL_L1, 0));
return jPanel;
}
}

5
designer-realize/src/main/java/com/fr/design/cell/editor/RichTextToolBar.java

@ -502,14 +502,15 @@ public class RichTextToolBar extends BasicPane{
//pt转为px =*4/3
private int scaleUp(int fontSize) {
return (int) FontTransformUtil.pt2px(fontSize);
return roundUp(FontTransformUtil.pt2px(fontSize));
}
//px转pt = *3/4
private int scaleDown(int fontSize) {
return (int) FontTransformUtil.px2pt(fontSize);
return roundUp(FontTransformUtil.px2pt(fontSize));
}
private DocumentListener inputListener = new DocumentListener() {
@Override

12
designer-realize/src/main/java/com/fr/design/mainframe/JPolyWorkBook.java

@ -1,6 +1,4 @@
/**
*
*/
package com.fr.design.mainframe;
import com.fr.design.mainframe.template.info.JPolyWorkBookProcessInfo;
@ -13,7 +11,6 @@ import com.fr.report.poly.PolyWorkSheet;
* 聚合报表Book, 跟WorkBook区别在于不能放入WorkSheet.
*
* @author neil
*
* @date: 2015-2-5-上午8:58:39
*/
public class JPolyWorkBook extends JWorkBook {
@ -32,15 +29,12 @@ public class JPolyWorkBook extends JWorkBook {
* 创建sheet名称tab面板
*
* @param reportCompositeX 当前组件对象
*
* @return sheet名称tab面板
*
* @date 2015-2-5-上午11:42:12
*
*/
@Override
public SheetNameTabPane createSheetNameTabPane(ReportComponentComposite reportCompositeX){
return new PolySheetNameTabPane(reportCompositeX);
public SheetNameTabPane createSheetNameTabPane(ReportComponentComposite reportCompositeX) {
return new SheetNameTabPane(reportCompositeX);
}
@Override

14
designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java

@ -208,13 +208,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
}
};
reportComposite.addTargetModifiedListener(new TargetModifiedListener() {
@Override
public void targetModified(TargetModifiedEvent e) {
JWorkBook.this.fireTargetModified();
}
});
reportComposite.addTargetModifiedListener(e -> JWorkBook.this.fireTargetModified());
reportComposite.setParentContainer(centerPane);
return centerPane;
@ -241,11 +235,11 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
/**
* 判断sheet权限
*
* @param rolsName 角色
* @param rolesName 角色
*/
@Override
public void judgeSheetAuthority(String rolsName) {
boolean isCovered = reportComposite.getEditingTemplateReport().getWorkSheetPrivilegeControl().checkInvisible(rolsName);
public void judgeSheetAuthority(String rolesName) {
boolean isCovered = reportComposite.getEditingTemplateReport().getWorkSheetPrivilegeControl().checkInvisible(rolesName);
centerPane.setSheeetCovered(isCovered);
centerPane.refreshContainer();
}

43
designer-realize/src/main/java/com/fr/design/mainframe/PolySheetNameTabPane.java

@ -1,35 +1,38 @@
package com.fr.design.mainframe;
import java.awt.Graphics2D;
import com.fr.design.menu.MenuDef;
import java.awt.Graphics2D;
/**
* 获取
*
*
* @date 2015-2-5-上午10:19:17
*
* @deprecated 让聚合报表也可以新建普通报表sheet, 逻辑和普通报表保持一致, 弃用此个性化设置
*/
public class PolySheetNameTabPane extends SheetNameTabPane{
/**
* 构造函数
*/
public PolySheetNameTabPane(ReportComponentComposite reportCompositeX) {
super(reportCompositeX);
}
protected void paintAddButton(Graphics2D g2d){
ADD_POLY_SHEET.paintIcon(this, g2d, iconLocation, 3);
@Deprecated
public class PolySheetNameTabPane extends SheetNameTabPane {
/**
* 构造函数
*/
public PolySheetNameTabPane(ReportComponentComposite reportCompositeX) {
super(reportCompositeX);
}
protected void paintAddButton(Graphics2D g2d) {
ADD_POLY_SHEET.paintIcon(this, g2d, iconLocation, 3);
}
protected void firstInsertActionPerformed(){
new PolyReportInsertAction().actionPerformed(null);
protected void firstInsertActionPerformed() {
new PolyReportInsertAction().actionPerformed(null);
}
protected void addInsertGridShortCut(MenuDef def){
protected void addInsertGridShortCut(MenuDef def) {
}
}

69
designer-realize/src/test/java/com/fr/design/cell/editor/RichTextToolBarTest.java

@ -0,0 +1,69 @@
package com.fr.design.cell.editor;
import com.fr.invoke.Reflect;
import org.easymock.EasyMock;
import org.junit.Assert;
import org.junit.Test;
/**
* Created by kerry on 2020-09-21
*/
public class RichTextToolBarTest {
@Test
public void testScaleUpAndDown() {
RichTextToolBar textToolBar = EasyMock.mock(RichTextToolBar.class);
int result = Reflect.on(textToolBar).call("scaleUp", 10).get();
Assert.assertEquals(13, result);
result = Reflect.on(textToolBar).call("scaleDown", 13).get();
Assert.assertEquals(10, result);
result = Reflect.on(textToolBar).call("scaleUp", 11).get();
Assert.assertEquals(15, result);
result = Reflect.on(textToolBar).call("scaleDown", 15).get();
Assert.assertEquals(11, result);
result = Reflect.on(textToolBar).call("scaleUp", 12).get();
Assert.assertEquals(16, result);
result = Reflect.on(textToolBar).call("scaleDown", 16).get();
Assert.assertEquals(12, result);
result = Reflect.on(textToolBar).call("scaleUp", 13).get();
Assert.assertEquals(17, result);
result = Reflect.on(textToolBar).call("scaleDown", 17).get();
Assert.assertEquals(13, result);
result = Reflect.on(textToolBar).call("scaleUp", 14).get();
Assert.assertEquals(19, result);
result = Reflect.on(textToolBar).call("scaleDown", 19).get();
Assert.assertEquals(14, result);
result = Reflect.on(textToolBar).call("scaleUp", 16).get();
Assert.assertEquals(21, result);
result = Reflect.on(textToolBar).call("scaleDown", 21).get();
Assert.assertEquals(16, result);
result = Reflect.on(textToolBar).call("scaleUp", 17).get();
Assert.assertEquals(23, result);
result = Reflect.on(textToolBar).call("scaleDown", 23).get();
Assert.assertEquals(17, result);
result = Reflect.on(textToolBar).call("scaleUp", 17).get();
Assert.assertEquals(23, result);
result = Reflect.on(textToolBar).call("scaleDown", 23).get();
Assert.assertEquals(17, result);
result = Reflect.on(textToolBar).call("scaleUp", 19).get();
Assert.assertEquals(25, result);
result = Reflect.on(textToolBar).call("scaleDown", 25).get();
Assert.assertEquals(19, result);
result = Reflect.on(textToolBar).call("scaleUp", 20).get();
Assert.assertEquals(27, result);
result = Reflect.on(textToolBar).call("scaleDown", 27).get();
Assert.assertEquals(20, result);
}
}
Loading…
Cancel
Save