Browse Source

Merge branch 'release/11.0' of ssh://code.fineres.com:7999/~kerry/design_10.0 into release/11.0

release/11.0
kerry 2 years ago
parent
commit
83402469d6
  1. 2
      designer-base/src/main/java/com/fr/design/DesignerEnvManager.java
  2. 5
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java
  3. 19
      designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java
  4. 12
      designer-base/src/main/java/com/fr/design/mainframe/JTemplateActionListener.java
  5. 18
      designer-base/src/main/java/com/fr/exit/ConfigToPropMigrator.java
  6. 39
      designer-realize/src/main/java/com/fr/design/sort/common/SortColumnRowPane.java
  7. 40
      designer-realize/src/main/java/com/fr/start/module/DesignerStartup.java

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

@ -2220,7 +2220,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
writer.attr("layoutTemplateStyle", this.getLayoutTemplateStyle()); writer.attr("layoutTemplateStyle", this.getLayoutTemplateStyle());
writer.attr("showServerDatasetAuthTip", this.isShowServerDatasetAuthTip()); writer.attr("showServerDatasetAuthTip", this.isShowServerDatasetAuthTip());
writer.attr("useOptimizedUPM4Adapter", this.isUseOptimizedUPM4Adapter()); writer.attr("useOptimizedUPM4Adapter", this.isUseOptimizedUPM4Adapter());
writer.attr("propertiesUsable", false); writer.attr("propertiesUsable", this.isPropertiesUsable());
writer.end(); writer.end();
} }

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

@ -66,6 +66,7 @@ import javax.swing.JPanel;
import javax.swing.JScrollPane; import javax.swing.JScrollPane;
import javax.swing.JSplitPane; import javax.swing.JSplitPane;
import javax.swing.JToolBar; import javax.swing.JToolBar;
import javax.swing.SwingUtilities;
import javax.swing.text.BadLocationException; import javax.swing.text.BadLocationException;
import javax.swing.text.Document; import javax.swing.text.Document;
import java.awt.BorderLayout; import java.awt.BorderLayout;
@ -303,7 +304,7 @@ public class DBTableDataPane extends AbstractTableDataPane<DBTableData> {
//显示对应的配置 //显示对应的配置
strategyConfigPane.populateBean(populateStrategyConfig); strategyConfigPane.populateBean(populateStrategyConfig);
BasicDialog dlg = strategyConfigPane.showMediumWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { BasicDialog dlg = strategyConfigPane.showMediumWindow(SwingUtilities.getWindowAncestor(DBTableDataPane.this), new DialogActionAdapter() {
@Override @Override
public void doOk() { public void doOk() {
super.doOk(); super.doOk();
@ -314,7 +315,7 @@ public class DBTableDataPane extends AbstractTableDataPane<DBTableData> {
} }
} }
}); });
dlg.setAlwaysOnTop(true); //dlg.setAlwaysOnTop(true);
dlg.setVisible(true); dlg.setVisible(true);
} }
}); });

19
designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java

@ -1014,7 +1014,7 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
// 过滤掉本地文件 // 过滤掉本地文件
boolean localFile = getEditingFILE() instanceof FileFILE; boolean localFile = getEditingFILE() instanceof FileFILE;
boolean inconsistent = !localFile && getEditingFILE().exists() boolean inconsistent = !localFile && getEditingFILE().exists()
&& !WorkContext.getCurrent().get(LockInfoOperator.class).isConsistentLock(getEditingFILE().getPath()); && !WorkContext.getCurrent().get(LockInfoOperator.class).isConsistentLock(getEditingFILE().getPath());
if (inconsistent) { if (inconsistent) {
throw new InconsistentLockException(); throw new InconsistentLockException();
} }
@ -1112,6 +1112,20 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
this.listenerList.remove(JTemplateActionListener.class, l); this.listenerList.remove(JTemplateActionListener.class, l);
} }
/**
* 模板保存前触发
*/
public void fireJTemplateSaveBefore() {
Object[] listeners = listenerList.getListenerList();
for (int i = listeners.length - 2; i >= 0; i -= 2) {
if (listeners[i] == JTemplateActionListener.class) {
((JTemplateActionListener) listeners[i + 1]).templateSaveBefore(this);
}
}
this.repaint(30);
}
/** /**
* 触发模板关闭 * 触发模板关闭
*/ */
@ -1622,6 +1636,7 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
} }
private CallbackSaveWorker save(boolean showLoc) { private CallbackSaveWorker save(boolean showLoc) {
fireJTemplateSaveBefore();
FILE editingFILE = this.getEditingFILE(); FILE editingFILE = this.getEditingFILE();
// carl:editingFILE没有,当然不存了,虽然不会有这种情况 // carl:editingFILE没有,当然不存了,虽然不会有这种情况
if (editingFILE == null) { if (editingFILE == null) {
@ -1917,7 +1932,7 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
} }
public void setDesignerUIMode(){ public void setDesignerUIMode() {
DesignerUIModeConfig.getInstance().setAbsoluteMeasureUIMode(); DesignerUIModeConfig.getInstance().setAbsoluteMeasureUIMode();
} }

12
designer-base/src/main/java/com/fr/design/mainframe/JTemplateActionListener.java

@ -4,9 +4,15 @@ import java.util.EventListener;
public interface JTemplateActionListener extends EventListener { public interface JTemplateActionListener extends EventListener {
public void templateOpened(JTemplate<?, ?> jt); default void templateOpened(JTemplate<?, ?> jt) {
}
public void templateSaved(JTemplate<?, ?> jt); default void templateSaved(JTemplate<?, ?> jt) {
}
public void templateClosed(JTemplate<?, ?> jt); default void templateClosed(JTemplate<?, ?> jt) {
}
default void templateSaveBefore(JTemplate<?, ?> jt) {
}
} }

18
designer-base/src/main/java/com/fr/exit/ConfigToPropMigrator.java

@ -10,6 +10,8 @@ import com.fr.workspace.WorkContext;
import java.io.File; import java.io.File;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.io.OutputStreamWriter;
import java.nio.charset.StandardCharsets;
import java.sql.Blob; import java.sql.Blob;
import java.sql.Connection; import java.sql.Connection;
import java.sql.DriverManager; import java.sql.DriverManager;
@ -62,9 +64,9 @@ public class ConfigToPropMigrator {
initDirectory(); initDirectory();
try (Connection c = DriverManager.getConnection(url); try (Connection c = DriverManager.getConnection(url);
FileOutputStream entityOut = new FileOutputStream(PropertiesConstants.ENTITY_PROP_PATH); OutputStreamWriter xmlEntityOut = new OutputStreamWriter(new FileOutputStream(PropertiesConstants.XML_ENTITY_PROP_PATH), StandardCharsets.UTF_8);
FileOutputStream classHelperOut = new FileOutputStream(PropertiesConstants.CLASS_NAME_PROP_PATH); OutputStreamWriter entityOut = new OutputStreamWriter(new FileOutputStream(PropertiesConstants.ENTITY_PROP_PATH), StandardCharsets.UTF_8);
FileOutputStream xmlEntityOut = new FileOutputStream(PropertiesConstants.XML_ENTITY_PROP_PATH)) { OutputStreamWriter classHelperOut = new OutputStreamWriter(new FileOutputStream(PropertiesConstants.CLASS_NAME_PROP_PATH), StandardCharsets.UTF_8)) {
processClassOrEntity(c, new Properties(), SELECT_FOR_ENTITY, entityOut); processClassOrEntity(c, new Properties(), SELECT_FOR_ENTITY, entityOut);
processClassOrEntity(c, new Properties(), SELECT_FOR_CLASSNAME, classHelperOut); processClassOrEntity(c, new Properties(), SELECT_FOR_CLASSNAME, classHelperOut);
@ -84,7 +86,7 @@ public class ConfigToPropMigrator {
} }
} }
private void processClassOrEntity(Connection c, Properties map, String sql, FileOutputStream outputStream) throws SQLException, IOException { private void processClassOrEntity(Connection c, Properties map, String sql, OutputStreamWriter writer) throws SQLException, IOException {
PreparedStatement query = c.prepareStatement(sql); PreparedStatement query = c.prepareStatement(sql);
ResultSet resultSet = query.executeQuery(); ResultSet resultSet = query.executeQuery();
while (resultSet.next()) { while (resultSet.next()) {
@ -94,19 +96,19 @@ public class ConfigToPropMigrator {
map.setProperty(id, value); map.setProperty(id, value);
} }
} }
map.store(outputStream, null); map.store(writer, null);
} }
private void processXmlEntity(Connection c, Properties map, FileOutputStream outputStream) throws SQLException, IOException { private void processXmlEntity(Connection c, Properties map, OutputStreamWriter writer) throws SQLException, IOException {
PreparedStatement query = c.prepareStatement(SELECT_FOR_XML_ENTITY); PreparedStatement query = c.prepareStatement(SELECT_FOR_XML_ENTITY);
ResultSet resultSet = query.executeQuery(); ResultSet resultSet = query.executeQuery();
while (resultSet.next()) { while (resultSet.next()) {
String id = resultSet.getString(1); String id = resultSet.getString(1);
Blob value = resultSet.getBlob(2); Blob value = resultSet.getBlob(2);
byte[] bytes = value.getBytes(1L, (int) value.length()); byte[] bytes = value.getBytes(1L, (int) value.length());
map.setProperty(id, new String(bytes)); map.setProperty(id, new String(bytes, StandardCharsets.UTF_8));
} }
map.store(outputStream, null); map.store(writer, null);
} }
public void deletePropertiesCache() { public void deletePropertiesCache() {

39
designer-realize/src/main/java/com/fr/design/sort/common/SortColumnRowPane.java

@ -3,13 +3,14 @@ package com.fr.design.sort.common;
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.base.svg.IconUtils; import com.fr.base.svg.IconUtils;
import com.fr.design.designer.TargetComponent;
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.file.HistoryTemplateListCache; import com.fr.design.file.HistoryTemplateListCache;
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.mainframe.ElementCasePane; import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.mainframe.JTemplateActionListener;
import com.fr.design.selection.SelectionEvent; import com.fr.design.selection.SelectionEvent;
import com.fr.design.selection.SelectionListener; import com.fr.design.selection.SelectionListener;
import com.fr.design.sort.header.HeaderAreaPane; import com.fr.design.sort.header.HeaderAreaPane;
@ -18,10 +19,6 @@ import com.fr.grid.selection.Selection;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
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.CellExpandAttr;
import com.fr.report.cell.cellattr.core.group.DSColumn;
import com.fr.report.core.sort.common.CellSortable;
import com.fr.report.core.sort.header.SortHeader;
import com.fr.report.elementcase.TemplateElementCase; import com.fr.report.elementcase.TemplateElementCase;
import com.fr.stable.ColumnRow; import com.fr.stable.ColumnRow;
import com.fr.stable.EssentialUtils; import com.fr.stable.EssentialUtils;
@ -157,6 +154,7 @@ public class SortColumnRowPane extends JPanel implements UIObserver {
class SelectActionListener extends MouseAdapter { class SelectActionListener extends MouseAdapter {
SortColumnRowPane columnRowPane; SortColumnRowPane columnRowPane;
ColumnRow oldColumnRow; ColumnRow oldColumnRow;
JTemplateActionListener jTemplateActionListener;
Map<ColumnRow, Style> disableHeaderCellsStyleMap = new HashMap<>(); Map<ColumnRow, Style> disableHeaderCellsStyleMap = new HashMap<>();
java.util.List<TemplateCellElement> tempHeaderCells = new ArrayList<>(); java.util.List<TemplateCellElement> tempHeaderCells = new ArrayList<>();
@ -178,13 +176,44 @@ public class SortColumnRowPane extends JPanel implements UIObserver {
@Override @Override
public void selectionChanged(SelectionEvent e) { public void selectionChanged(SelectionEvent e) {
completeSelectHeader(elementCasePane); completeSelectHeader(elementCasePane);
removeJTemplateActionListener();
} }
}; };
elementCasePane.addSelectionChangeListener(gridSelectionChangeListener); elementCasePane.addSelectionChangeListener(gridSelectionChangeListener);
this.addJTemplateActionListener();
isAlreadyAddListener = true; isAlreadyAddListener = true;
} }
} }
private void addJTemplateActionListener() {
JTemplate jTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
if (jTemplate != null) {
removeJTemplateActionListener();
jTemplateActionListener = new JTemplateActionListener() {
@Override
public void templateSaveBefore(JTemplate<?, ?> jt) {
ElementCasePane elementCasePane = SortUtils.getCurrentElementCase();
if (elementCasePane != null) {
recoverSelectHeader(elementCasePane);
}
removeJTemplateActionListener();
}
};
jTemplate.addJTemplateActionListener(jTemplateActionListener);
}
}
private void removeJTemplateActionListener() {
JTemplate jTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
if (jTemplate != null) {
if (jTemplateActionListener != null) {
jTemplate.removeJTemplateActionListener(jTemplateActionListener);
}
}
}
private void prepareSelectHeader(ElementCasePane elementCasePane) { private void prepareSelectHeader(ElementCasePane elementCasePane) {
ashDisableHeaderCellsStyle(elementCasePane.getEditingElementCase()); ashDisableHeaderCellsStyle(elementCasePane.getEditingElementCase());
oldSelection = (CellSelection) elementCasePane.getSelection(); oldSelection = (CellSelection) elementCasePane.getSelection();

40
designer-realize/src/main/java/com/fr/start/module/DesignerStartup.java

@ -158,26 +158,26 @@ public class DesignerStartup extends Activator {
private void registerDaoSelector() { private void registerDaoSelector() {
// 注入设计器db cache 是否可用 // 注入设计器db cache 是否可用
DaoSelectorFactory.registerDaoSelector(() -> false); DesignerWorkspaceInfo info = WorkspaceUtils.getWorkspaceInfo();
// DesignerWorkspaceInfo info = WorkspaceUtils.getWorkspaceInfo(); if (info.getType() == DesignerWorkspaceType.Remote) {
// if (info.getType() == DesignerWorkspaceType.Remote) { DaoSelectorFactory.registerDaoSelector(() -> false);
// } else { } else {
// String webInfPath = WorkspaceUtils.getWorkspaceInfo().getPath(); String webInfPath = WorkspaceUtils.getWorkspaceInfo().getPath();
// String dbConfigPath = StableUtils.pathJoin(webInfPath, ProjectConstants.CONFIG_DIRECTORY, String dbConfigPath = StableUtils.pathJoin(webInfPath, ProjectConstants.CONFIG_DIRECTORY,
// EncryptionConstants.PROPERTY_NAME); EncryptionConstants.PROPERTY_NAME);
// String entityPath = generatePath(webInfPath, PropertiesConstants.ENTITY_PROP); String entityPath = generatePath(webInfPath, PropertiesConstants.ENTITY_PROP);
// String xmlEntityPath = generatePath(webInfPath, PropertiesConstants.XML_ENTITY_PROP); String xmlEntityPath = generatePath(webInfPath, PropertiesConstants.XML_ENTITY_PROP);
// String classNamePath = generatePath(webInfPath, PropertiesConstants.CLASS_NAME_PROP); String classNamePath = generatePath(webInfPath, PropertiesConstants.CLASS_NAME_PROP);
// // 校验 平台迁移文件/缓存文件 // 校验 平台迁移文件/缓存文件
// boolean existPropCache = new File(entityPath).exists() && new File(xmlEntityPath).exists() && new File(classNamePath).exists(); boolean existPropCache = new File(entityPath).exists() && new File(xmlEntityPath).exists() && new File(classNamePath).exists();
// DaoSelectorFactory.registerDaoSelector(() -> DesignerEnvManager.getEnvManager().isPropertiesUsable() DaoSelectorFactory.registerDaoSelector(() -> DesignerEnvManager.getEnvManager().isPropertiesUsable()
// && OptimizeUtil.isOpen() && OptimizeUtil.isOpen()
// && existPropCache && existPropCache
// // demo启动时 前后目录可能会不一致 造成读取缓存失败 // demo启动时 前后目录可能会不一致 造成读取缓存失败
// && !startupArgsValue.getValue().isDemo() && !startupArgsValue.getValue().isDemo()
// && !new File(dbConfigPath).exists()); && !new File(dbConfigPath).exists());
//
// } }
} }
private String generatePath(String webInfPath, String name) { private String generatePath(String webInfPath, String name) {

Loading…
Cancel
Save