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
368f846995
  1. 5
      designer-base/src/main/java/com/fr/design/actions/TableDataSourceAction.java
  2. 7
      designer-base/src/main/java/com/fr/design/actions/server/GlobalTableDataAction.java
  3. 18
      designer-base/src/main/java/com/fr/design/data/datapane/preview/PreviewTableModel.java
  4. 4
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java
  5. 2
      designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java
  6. 20
      designer-base/src/main/java/com/fr/design/formula/FormulaPane.java
  7. 2
      designer-base/src/main/java/com/fr/design/gui/syntax/ui/rtextarea/RTextAreaBase.java
  8. 4
      designer-base/src/main/java/com/fr/design/parameter/ParameterDesignerProvider.java
  9. 10
      designer-base/src/test/java/com/fr/design/formula/FormulaPaneTest.java
  10. 5
      designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRAbsoluteLayoutAdapter.java
  11. 15
      designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java
  12. 8
      designer-form/src/main/java/com/fr/design/designer/creator/XWFitLayout.java
  13. 17
      designer-form/src/main/java/com/fr/design/form/parameter/FormParaDesigner.java
  14. 1
      designer-form/src/main/java/com/fr/design/mainframe/JForm.java
  15. 2
      designer-form/src/main/java/com/fr/design/parameter/ParameterPropertyPane.java
  16. 46
      designer-form/src/test/java/com/fr/design/designer/beans/adapters/layout/FRAbsoluteLayoutAdapterTest.java
  17. 26
      designer-realize/src/main/java/com/fr/design/parameter/ParameterDefinitePane.java
  18. 2
      designer-realize/src/main/java/com/fr/grid/GridUI.java
  19. 4
      pom.xml

5
designer-base/src/main/java/com/fr/design/actions/TableDataSourceAction.java

@ -15,6 +15,7 @@ import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
/*
@ -51,6 +52,10 @@ public class TableDataSourceAction extends TemplateComponentAction<JTemplate<?,
reportTableDataDialog.setDoOKSucceed(false);
return;
}
Iterator<String> iterator = tds.getTableDataNameIterator();
while (iterator.hasNext()) {
DesignTableDataManager.removeSelectedColumnNames(iterator.next());
}
DesignModelAdapter.getCurrentModelAdapter().renameTableData(tableDataPane.getDsNameChangedMap());
tableDataPane.update(tds);
TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter());

7
designer-base/src/main/java/com/fr/design/actions/server/GlobalTableDataAction.java

@ -5,7 +5,6 @@ package com.fr.design.actions.server;
import com.fr.base.BaseUtils;
import com.fr.base.TableData;
import com.fr.config.Configuration;
import com.fr.design.DesignModelAdapter;
import com.fr.design.actions.UpdateAction;
import com.fr.design.data.DesignTableDataManager;
@ -18,12 +17,10 @@ import com.fr.design.gui.NameInspector;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.DesignerFrame;
import com.fr.design.menu.MenuKeySet;
import com.fr.file.ProcedureConfig;
import com.fr.file.TableDataConfig;
import com.fr.transaction.CallBackAdaptor;
import com.fr.transaction.Configurations;
import com.fr.transaction.Worker;
import com.fr.transaction.WorkerFacade;
import javax.swing.KeyStroke;
@ -95,6 +92,10 @@ public class GlobalTableDataAction extends UpdateAction implements ResponseDataS
}
DesignTableDataManager.clearGlobalDs();
// 保存时 移除服务器数据集列名缓存
for (String name : tableDataConfig.getTableDatas().keySet()) {
DesignTableDataManager.removeSelectedColumnNames(name);
}
Configurations.modify(new WorkerFacade(TableDataConfig.class) {
@Override

18
designer-base/src/main/java/com/fr/design/data/datapane/preview/PreviewTableModel.java

@ -17,6 +17,10 @@ import javax.swing.table.AbstractTableModel;
* 这个TableModel主要是预览数据的. 字段TableData必须转化为内置的
*/
public class PreviewTableModel extends AbstractTableModel {
private static final int LEN_LIMIT = 1000;
private static final String THREE_DOT = "...";
private DataModel dataModel;
private String erroMessage = null;
@ -127,11 +131,21 @@ public class PreviewTableModel extends AbstractTableModel {
public Object getValueAt(int row, int column) {
try {
return dataModel.getValueAt(row, column);
Object value = dataModel.getValueAt(row, column);
if (value != null) {
String strValue = value.toString();
// 字符长度过长 swing会卡住一会
// 同时设计器内预览展示也不需要展示太长的字符
if (strValue.length() > LEN_LIMIT) {
strValue = strValue.substring(0, LEN_LIMIT) + THREE_DOT;
return strValue;
}
}
return value;
} catch (TableDataException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
DesignUtils.errorMessage(e.getMessage());
return "";
return StringUtils.EMPTY;
}
}

4
designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java

@ -29,7 +29,6 @@ import com.fr.design.gui.itableeditorpane.UITableEditorPane;
import com.fr.design.gui.itoolbar.UIToolbar;
import com.fr.design.gui.syntax.ui.rsyntaxtextarea.SyntaxConstants;
import com.fr.design.gui.syntax.ui.rtextarea.RTextScrollPane;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.menu.SeparatorDef;
import com.fr.design.menu.ToolBarDef;
@ -316,7 +315,8 @@ public class DBTableDataPane extends AbstractTableDataPane<DBTableData> {
// com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Connect_SQL_Cannot_Null") + ".");
}
}
// 保存前 刷新下参数列表 保证获取到最新的参数
refresh();
List<ParameterProvider> parameterList = editorPane.update();
Parameter[] parameters = parameterList.toArray(new Parameter[parameterList.size()]);

2
designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java

@ -226,6 +226,8 @@ public class TemplateTreePane extends JPanel implements FileOperations {
*/
@Override
public void refresh() {
// 刷新远程文件夹权限
NodeAuthProcessor.getInstance().refresh();
reportletsTree.refresh();
FineLoggerFactory.getLogger().info(Toolkit.i18nText("Fine-Design_Basic_Template_File_Tree_Refresh_Successfully") + "!");
}

20
designer-base/src/main/java/com/fr/design/formula/FormulaPane.java

@ -1008,15 +1008,23 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula {
this.searchKey = searchKey.toLowerCase();
}
/**
* 把以关键词开头的和不以关键词开头的分别按照字母表顺序排序
* @param o1 待比较对象1
* @param o2 待比较对象2
* @return 比较结果1表示 o1 > o2, -1表示 o1 < o2, 0表示 o1 = o2
*/
@Override
public int compare(String o1, String o2) {
if (o1.toLowerCase().startsWith(searchKey)) {
return -1;
}
if (o2.toLowerCase().startsWith(searchKey)) {
return 1;
int result;
boolean o1StartWith = o1.toLowerCase().startsWith(searchKey);
boolean o2StartWith = o2.toLowerCase().startsWith(searchKey);
if (o1StartWith) {
result = o2StartWith ? o1.compareTo(o2) : -1;
} else {
result = o2StartWith ? 1 : o1.compareTo(o2);
}
return o2.compareTo(o1);
return result;
}
}

2
designer-base/src/main/java/com/fr/design/gui/syntax/ui/rtextarea/RTextAreaBase.java

@ -25,6 +25,7 @@ import javax.swing.JTextArea;
import javax.swing.event.CaretEvent;
import javax.swing.plaf.ColorUIResource;
import javax.swing.plaf.TextUI;
import javax.swing.plaf.basic.BasicBorders;
import javax.swing.text.AbstractDocument;
import javax.swing.text.BadLocationException;
import javax.swing.text.Caret;
@ -645,6 +646,7 @@ int currentCaretY; // Used to know when to rehighlight current line.
setTabsEmulated(false);
// Stuff needed by the caret listener below.
setBorder(new BasicBorders.MarginBorder());
previousCaretY = currentCaretY = getInsets().top;
// Stuff to highlight the current line.

4
designer-base/src/main/java/com/fr/design/parameter/ParameterDesignerProvider.java

@ -50,6 +50,10 @@ public interface ParameterDesignerProvider {
void addingAllParameter2Editor(Parameter[] parameterArray, int currentIndex);
default int addingAllParameter2EditorWithReturnValue(Parameter[] parameterArray, int currentIndex) {
return 0;
}
JPanel[] toolbarPanes4Form();
JComponent[] toolBarButton4Form();

10
designer-base/src/test/java/com/fr/design/formula/FormulaPaneTest.java

@ -22,4 +22,12 @@ public class FormulaPaneTest extends TestCase {
Assert.assertArrayEquals(result, strs);
}
}
@Test
public void test4SimilarComparator() {
String[] strs = new String[]{"TESTB", "TESTACD", "Ftest", "Gtest", "TEST"};
String[] result = new String[]{"TEST", "TESTACD", "TESTB", "Ftest", "Gtest"};
Arrays.sort(strs, new FormulaPane.SimilarComparator("test"));
Assert.assertArrayEquals(result, strs);
}
}

5
designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRAbsoluteLayoutAdapter.java

@ -310,14 +310,15 @@ public class FRAbsoluteLayoutAdapter extends FRBodyLayoutAdapter {
public void fix(XCreator creator ,int x, int y) {
int height = creator.getHeight();
int width = creator.getWidth();
//坐标小于0时让它还在容器内
if (x < 0) {
x = container.getX();
x = 0;
} else if (x + creator.getWidth() > container.getWidth()) {
x = container.getWidth() - width;
}
if (y < 0) {
y = container.getY();
y = 0;
} else if (y + creator.getHeight() > container.getHeight()) {
y = container.getHeight() - height;
}

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

@ -114,6 +114,15 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter {
XCreator creator = (XCreator) container.getComponent(i);
creator.updateChildBound(minHeight);
creator.setBackupBound(creator.getBounds());
//tab布局用到
ArrayList<?> childrenList = creator.getTargetChildrenList();
for (int j = 0; j < childrenList.size(); j++) {
XWTabFitLayout tabLayout = (XWTabFitLayout) childrenList.get(j);
for (int m = 0; m < tabLayout.getComponentCount(); m++) {
XCreator childCreator = tabLayout.getXCreator(m);
childCreator.setBackupBound(childCreator.getBounds());
}
}
}
}
@ -1039,15 +1048,15 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter {
XWTabFitLayout tabLayout = (XWTabFitLayout) childrenList.get(j);
tabLayout.setBackupBound(tabLayout.getBounds());
int refSize = isHor ? tabLayout.getWidth() : tabLayout.getHeight();
double percent = (double) offset / refSize;
double percent = offset / (double) (refSize - offset);
if (percent < 0 && !tabLayout.canReduce(percent)) {
return;
}
setAdjustedSize(tabLayout, offset, isHor);
for (int m = 0; m < tabLayout.getComponentCount(); m++) {
XCreator childCreator = tabLayout.getXCreator(m);
WAbsoluteLayout.BoundsWidget wgt = (WAbsoluteLayout.BoundsWidget) tabLayout.toData().getBoundsWidget(childCreator.toData());
wgt.setBounds(tabLayout.getComponent(m).getBounds());
wgt.setBounds(childCreator.getBackupBound());
wgt.setBackupBounds(childCreator.getBackupBound());
}
adjustCreatorsSize(percent, tabLayout, isHor);
}

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

@ -19,6 +19,7 @@ import com.fr.form.ui.container.WBodyLayoutType;
import com.fr.form.ui.container.WFitLayout;
import com.fr.form.ui.container.WLayout;
import com.fr.form.ui.widget.CRBoundsWidget;
import com.fr.general.ComparatorUtils;
import com.fr.general.FRLogger;
import com.fr.general.FRScreen;
import com.fr.stable.ArrayUtils;
@ -1125,7 +1126,12 @@ public class XWFitLayout extends XLayoutContainer {
public Component getBottomComp(int x, int y, int h) {
int val = getAcualInterval();
return this.getComponentAt(x, y+h+default_Length+val);
Component comp = this.getComponentAt(x, y+h+default_Length+val);
if (ComparatorUtils.equals(this, comp)) {
// 如果获取组件等于自身 说明存在偏移 加上一个默认偏移量
return this.getComponentAt(x + default_Length, y+h+default_Length+val);
}
return comp;
}
public Component getRightTopComp(int x, int y, int w) {

17
designer-form/src/main/java/com/fr/design/form/parameter/FormParaDesigner.java

@ -74,7 +74,7 @@ import java.util.List;
public class FormParaDesigner extends FormDesigner implements ParameterDesignerProvider {
private static final int NUM_IN_A_LINE = 4;
private static final int H_COMPONENT_GAP = 165;
private static final int V_COMPONENT_GAP = 25;
public static final int V_COMPONENT_GAP = 25;
private static final int FIRST_V_LOCATION = 35;
private static final int FIRST_H_LOCATION = 90;
private static final int SECOND_H_LOCATION = 170;
@ -640,6 +640,18 @@ public class FormParaDesigner extends FormDesigner implements ParameterDesignerP
* @return 是否加入 s
*/
public void addingAllParameter2Editor(Parameter[] parameterArray, int currentIndex) {
addingAllParameter2EditorWithReturnValue(parameterArray, currentIndex);
}
/**
* @param parameterArray 参数数组
* @param currentIndex 添加所有参数前的index值
* @Description: 添加所有的参数并返回当前的currentIndex此方法为addingAllParameter2Editor的兼容方法
* @return: 添加所有参数后的index值
* @Author: Henry.Wang
* @date: 2020/8/5 19:40
*/
public int addingAllParameter2EditorWithReturnValue(Parameter[] parameterArray, int currentIndex) {
for (int i = 0; i < parameterArray.length; i++) {
com.fr.form.ui.Label label = new com.fr.form.ui.Label();
label.setWidgetName("Label" + parameterArray[i].getName());
@ -667,9 +679,10 @@ public class FormParaDesigner extends FormDesigner implements ParameterDesignerP
XCreator xCreator = XCreatorUtils.createXCreator(formSubmitButton);
if (!(this.autoAddComponent(xCreator, H_COMPONENT_GAP * 3 + H_GAP, FIRST_V_LOCATION
+ V_COMPONENT_GAP * (currentIndex / NUM_IN_A_LINE)))) {
return;
currentIndex = ((int) Math.ceil((currentIndex + 1) / (double) NUM_IN_A_LINE)) * NUM_IN_A_LINE;
}
}
return currentIndex;
}
/**

1
designer-form/src/main/java/com/fr/design/mainframe/JForm.java

@ -371,6 +371,7 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm<F
return;
}
ParameterPropertyPane.getInstance().setAddParaPaneVisible(isAddParaPaneVisible(comp), this);
ParameterPropertyPane.getInstance().updateAddParaPaneSize();
editingComponent = comp.createToolPane(this, formDesign);
if (DesignerMode.isAuthorityEditing()) {
EastRegionContainerPane.getInstance().replaceWidgetSettingsPane(

2
designer-form/src/main/java/com/fr/design/parameter/ParameterPropertyPane.java

@ -103,7 +103,7 @@ public class ParameterPropertyPane extends JPanel{
refreshState(DesignerContext.getDesignerFrame().getSelectedJTemplate());
}
private void updateAddParaPaneSize() {
public void updateAddParaPaneSize() {
if (!addParaPane.isVisible()) {
return;
}

46
designer-form/src/test/java/com/fr/design/designer/beans/adapters/layout/FRAbsoluteLayoutAdapterTest.java

@ -0,0 +1,46 @@
package com.fr.design.designer.beans.adapters.layout;
import com.fr.config.dao.DaoContext;
import com.fr.config.dao.impl.LocalClassHelperDao;
import com.fr.config.dao.impl.LocalEntityDao;
import com.fr.config.dao.impl.LocalXmlEntityDao;
import com.fr.design.designer.creator.XButton;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XWAbsoluteLayout;
import com.fr.form.ui.Button;
import com.fr.form.ui.container.WAbsoluteLayout;
import java.awt.Dimension;
import junit.framework.TestCase;
import org.junit.Assert;
public class FRAbsoluteLayoutAdapterTest extends TestCase {
@Override
protected void setUp() throws Exception {
DaoContext.setEntityDao(new LocalEntityDao());
DaoContext.setClassHelperDao(new LocalClassHelperDao());
DaoContext.setXmlEntityDao(new LocalXmlEntityDao());
}
public void testFix(){
WAbsoluteLayout layout =new WAbsoluteLayout();
XWAbsoluteLayout container =new XWAbsoluteLayout(layout);
container.setBounds(0,320,400,160);
FRAbsoluteLayoutAdapter frAbsoluteLayoutAdapter = new FRAbsoluteLayoutAdapter(container);
XCreator button = new XButton(new Button(),new Dimension(88,40));
frAbsoluteLayoutAdapter.fix(button,-1,-1);
Assert.assertEquals(0,button.getX());
Assert.assertEquals(0,button.getY());
frAbsoluteLayoutAdapter.fix(button,350,200);
Assert.assertEquals(312,button.getX());
Assert.assertEquals(120,button.getY());
}
@Override
protected void tearDown() throws Exception {
DaoContext.setEntityDao(null);
DaoContext.setClassHelperDao(null);
DaoContext.setXmlEntityDao(null);
}
}

26
designer-realize/src/main/java/com/fr/design/parameter/ParameterDefinitePane.java

@ -17,6 +17,7 @@ import com.fr.design.designer.TargetComponent;
import com.fr.design.event.TargetModifiedEvent;
import com.fr.design.event.TargetModifiedListener;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.form.parameter.FormParaDesigner;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.layout.FRGUIPaneFactory;
@ -30,6 +31,10 @@ import com.fr.design.menu.ShortCut;
import com.fr.design.menu.ToolBarDef;
import com.fr.design.module.DesignModuleFactory;
import com.fr.design.style.background.BackgroundPane;
import com.fr.form.main.parameter.FormParameterUI;
import com.fr.form.ui.Widget;
import com.fr.form.ui.container.WAbsoluteLayout;
import com.fr.form.ui.container.WLayout;
import com.fr.log.FineLoggerFactory;
import com.fr.main.parameter.ReportParameterAttr;
import com.fr.main.parameter.TemplateParameterAttr;
@ -46,6 +51,7 @@ import java.awt.Color;
import java.awt.Component;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
@ -249,6 +255,22 @@ public class ParameterDefinitePane extends JPanel implements ToolBarMenuDockPlus
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
currentIndex = reportParameterAttr.getCurrentIndex();
//因为以前的版本没有保存currentIndex,所以要计算currentIndex的值
if (parameterUI != null && parameterUI instanceof FormParameterUI && currentIndex == 0) {
WLayout wLayout = ((FormParameterUI) parameterUI).getContainer();
int widgetCount = wLayout.getWidgetCount();
Rectangle endRec = null;
for (int i = 0; i < widgetCount; i++) {
Widget widget = wLayout.getWidget(i);
Rectangle tempRec = ((WAbsoluteLayout.BoundsWidget) widget).getBounds();
if (endRec == null || tempRec.y > endRec.y) {
endRec = tempRec;
}
}
if (endRec != null)
currentIndex = (int) (Math.ceil(endRec.y / FormParaDesigner.V_COMPONENT_GAP)) * NUM_IN_A_LINE;
}
paraDesignEditor.populate(parameterUI);
@ -268,8 +290,6 @@ public class ParameterDefinitePane extends JPanel implements ToolBarMenuDockPlus
bridge.setBackground(reportParameterAttr.getBackground());
bridge.setUseParamsTemplate(reportParameterAttr.isUseParamsTemplate());
}
currentIndex = reportParameterAttr.getCurrentIndex();
}
@ -438,7 +458,7 @@ public class ParameterDefinitePane extends JPanel implements ToolBarMenuDockPlus
return;
}
paraDesignEditor.addingAllParameter2Editor(parameterArray, currentIndex);
currentIndex = paraDesignEditor.addingAllParameter2EditorWithReturnValue(parameterArray, currentIndex);
parameterArray = null;
refreshParameter();

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

@ -481,7 +481,7 @@ public class GridUI extends ComponentUI {
// peter:tmpRectangle2D_3只是一个临时的Rectangle2D,由于后面不少地方需要用到这个矩形
this.cell_back_rect.setRect(0, 0, this.tmpRectangle.getWidth() - 1,
this.tmpRectangle.getHeight() - 1);
this.tmpRectangle.getHeight() - 1.5);
// peter:对于合并的单元格,需要先白色的背景来清除背景.
if (tmpCellElement.getColumnSpan() > 1 || tmpCellElement.getRowSpan() > 1) {
// REPORT-23492 要看下是否设置了纸张背景 如果设置了按照背景来画

4
pom.xml

@ -28,8 +28,8 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>

Loading…
Cancel
Save