diff --git a/designer-base/src/main/java/com/fr/design/actions/TableDataSourceAction.java b/designer-base/src/main/java/com/fr/design/actions/TableDataSourceAction.java index 600f9721e..a0ca4d955 100644 --- a/designer-base/src/main/java/com/fr/design/actions/TableDataSourceAction.java +++ b/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 iterator = tds.getTableDataNameIterator(); + while (iterator.hasNext()) { + DesignTableDataManager.removeSelectedColumnNames(iterator.next()); + } DesignModelAdapter.getCurrentModelAdapter().renameTableData(tableDataPane.getDsNameChangedMap()); tableDataPane.update(tds); TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()); diff --git a/designer-base/src/main/java/com/fr/design/actions/file/OpenRecentReportMenuDef.java b/designer-base/src/main/java/com/fr/design/actions/file/OpenRecentReportMenuDef.java index 2bb026159..7533cb133 100644 --- a/designer-base/src/main/java/com/fr/design/actions/file/OpenRecentReportMenuDef.java +++ b/designer-base/src/main/java/com/fr/design/actions/file/OpenRecentReportMenuDef.java @@ -1,6 +1,7 @@ package com.fr.design.actions.file; import java.awt.event.ActionEvent; +import java.io.File; import java.util.List; import com.fr.base.BaseUtils; @@ -11,6 +12,7 @@ import com.fr.design.mainframe.DesignerContext; import com.fr.design.menu.KeySetUtils; import com.fr.design.menu.MenuDef; import com.fr.file.FILEFactory; +import com.fr.file.FileFILE; /** * Open Resent MenuDef. @@ -68,7 +70,12 @@ public class OpenRecentReportMenuDef extends MenuDef { * @param e 事件 */ public void actionPerformed(ActionEvent e) { - DesignerContext.getDesignerFrame().openTemplate(FILEFactory.createFILE(this.getPath())); + File file = new File(this.getPath()); + if (file.exists()) { + DesignerContext.getDesignerFrame().openTemplate(new FileFILE(file)); + } else { + DesignerContext.getDesignerFrame().openTemplate(FILEFactory.createFILE(this.getPath())); + } } public String getPath() { diff --git a/designer-base/src/main/java/com/fr/design/actions/server/GlobalTableDataAction.java b/designer-base/src/main/java/com/fr/design/actions/server/GlobalTableDataAction.java index 0e9db97c7..627a862fb 100644 --- a/designer-base/src/main/java/com/fr/design/actions/server/GlobalTableDataAction.java +++ b/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 diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/preview/PreviewTableModel.java b/designer-base/src/main/java/com/fr/design/data/datapane/preview/PreviewTableModel.java index 575ba43f5..46706cf59 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/preview/PreviewTableModel.java +++ b/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; } } diff --git a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java index 6ad281e26..6f0e89ff4 100644 --- a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java +++ b/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 { // com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Connect_SQL_Cannot_Null") + "."); } } - + // 保存前 刷新下参数列表 保证获取到最新的参数 + refresh(); List parameterList = editorPane.update(); Parameter[] parameters = parameterList.toArray(new Parameter[parameterList.size()]); diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRAbsoluteLayoutAdapter.java b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRAbsoluteLayoutAdapter.java index 4bc0f22e4..0c6adeb09 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRAbsoluteLayoutAdapter.java +++ b/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; } diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java index f2156e861..dfb4d9409 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java +++ b/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); } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/JForm.java b/designer-form/src/main/java/com/fr/design/mainframe/JForm.java index 2fbccb1cd..7cdd7fd60 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/JForm.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/JForm.java @@ -371,6 +371,7 @@ public class JForm extends JTemplate implements BaseJForm 1 || tmpCellElement.getRowSpan() > 1) { // REPORT-23492 要看下是否设置了纸张背景 如果设置了按照背景来画