diff --git a/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java b/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java index 1f39f024d2..b57ad6c7af 100644 --- a/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java +++ b/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java @@ -23,6 +23,7 @@ import com.fr.design.mainframe.ComponentReuseNotifyUtil; import com.fr.design.mainframe.reuse.ComponentReuseNotificationInfo; import com.fr.design.mainframe.vcs.VcsConfigManager; import com.fr.design.notification.SnapChatConfig; +import com.fr.design.os.impl.SupportOSImpl; import com.fr.design.port.DesignerPortContext; import com.fr.design.style.color.ColorSelectConfigManager; import com.fr.design.update.push.DesignerPushUpdateConfigManager; @@ -211,6 +212,8 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { private int layoutTemplateStyle = LAYOUT_TEMPLATE_SIMPLE_STYLE; + private boolean useOptimizedUPM4Adapter; + /** * DesignerEnvManager. */ @@ -665,6 +668,14 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { this.showTemplateMissingPlugin = showTemplateMissingPlugin; } + public boolean isUseOptimizedUPM4Adapter() { + return useOptimizedUPM4Adapter; + } + + public void setUseOptimizedUPM4Adapter(boolean useOptimizedUPM4Adapter) { + this.useOptimizedUPM4Adapter = useOptimizedUPM4Adapter; + } + /** * 知否自动备份 * @@ -1888,6 +1899,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { } this.setEmbedServerLazyStartup(reader.getAttrAsBoolean("embedServerLazyStartup", false)); this.setShowTemplateMissingPlugin(reader.getAttrAsBoolean("showTemplateMissingPlugin", true)); + this.setUseOptimizedUPM4Adapter(reader.getAttrAsBoolean("useOptimizedUPM4Adapter", SupportOSImpl.MACOS_12_VERSION_ADAPTER.support())); this.setShowServerDatasetAuthTip(reader.getAttrAsBoolean("showServerDatasetAuthTip", true)); this.setLayoutTemplateStyle(reader.getAttrAsInt("layoutTemplateStyle", LAYOUT_TEMPLATE_SIMPLE_STYLE)); } @@ -2165,6 +2177,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { } writer.attr("layoutTemplateStyle", this.getLayoutTemplateStyle()); writer.attr("showServerDatasetAuthTip", this.isShowServerDatasetAuthTip()); + writer.attr("useOptimizedUPM4Adapter", this.isUseOptimizedUPM4Adapter()); writer.end(); } diff --git a/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java b/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java index c0797e9462..5a777b895d 100644 --- a/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java +++ b/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java @@ -16,9 +16,10 @@ import com.fr.design.gui.ibutton.UINoThemeColorButton; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIDictionaryComboBox; +import com.fr.design.gui.ifilechooser.FileChooserArgs; +import com.fr.design.gui.ifilechooser.FileChooserFactory; import com.fr.design.gui.ifilechooser.FileChooserProvider; import com.fr.design.gui.ifilechooser.FileSelectionMode; -import com.fr.design.gui.ifilechooser.JavaFxNativeFileChooser; import com.fr.design.gui.ilable.ActionLabel; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.iprogressbar.UIProgressBarUI; @@ -513,9 +514,8 @@ public class PreferencePane extends BasicPane { @Override public void actionPerformed(ActionEvent evt) { FileChooserProvider fileChooserProvider = - new JavaFxNativeFileChooser.Builder(). - fileSelectionMode(FileSelectionMode.DIR). - build(); + FileChooserFactory.createFileChooser(FileChooserArgs.newBuilder(). + setFileSelectionMode(FileSelectionMode.DIR).build()); int saveValue = fileChooserProvider.showDialog(chooseDirBtn); if (saveValue == JFileChooser.APPROVE_OPTION) { File selectedFile = fileChooserProvider.getSelectedFile(); @@ -728,7 +728,8 @@ public class PreferencePane extends BasicPane { this.portEditor.setValue(new Integer(designerEnvManager.getEmbedServerPort())); if (useOptimizedUPMCheckbox != null) { - useOptimizedUPMCheckbox.setSelected(ServerPreferenceConfig.getInstance().isUseOptimizedUPM()); + useOptimizedUPMCheckbox.setSelected(ServerPreferenceConfig.getInstance().isUseOptimizedUPM() + || DesignerEnvManager.getEnvManager().isUseOptimizedUPM4Adapter()); } if (useNewVersionLoginCheckbox != null) { @@ -808,6 +809,7 @@ public class PreferencePane extends BasicPane { designerEnvManager.setJoinProductImprove(this.joinProductImproveCheckBox.isSelected()); designerEnvManager.setEmbedServerLazyStartup(this.embedServerLazyStartupCheckBox.isSelected()); designerEnvManager.setImageCompress(this.imageCompressPanelCheckBox.isSelected()); + designerEnvManager.setUseOptimizedUPM4Adapter(this.useOptimizedUPMCheckbox != null && this.useOptimizedUPMCheckbox.isSelected()); VcsConfigManager vcsConfigManager = designerEnvManager.getVcsConfigManager(); vcsConfigManager.setSaveInterval(this.saveIntervalEditor.getValue()); vcsConfigManager.setVcsEnable(this.vcsEnableCheckBox.isSelected()); diff --git a/designer-base/src/main/java/com/fr/design/base/clipboard/ClipboardFilter.java b/designer-base/src/main/java/com/fr/design/base/clipboard/ClipboardFilter.java index 140a46579d..22fff0d178 100644 --- a/designer-base/src/main/java/com/fr/design/base/clipboard/ClipboardFilter.java +++ b/designer-base/src/main/java/com/fr/design/base/clipboard/ClipboardFilter.java @@ -27,11 +27,7 @@ public abstract class ClipboardFilter { } public static T cut(T selection) { - - ExtraDesignClassManager manager = PluginModule.getAgent(PluginModule.ExtraDesign); - Set providers = manager.getArray(ClipboardHandlerProvider.XML_TAG); - providers.addAll(clipboardHandlerProviders); - for (ClipboardHandlerProvider provider : providers) { + for (ClipboardHandlerProvider provider : getClipboardHandlerProviders()) { if (provider.support(selection)) { selection = ((ClipboardHandlerProvider) provider).cut(selection); } @@ -40,10 +36,7 @@ public abstract class ClipboardFilter { } public static T copy(T selection) { - ExtraDesignClassManager manager = PluginModule.getAgent(PluginModule.ExtraDesign); - Set providers = manager.getArray(ClipboardHandlerProvider.XML_TAG); - providers.addAll(clipboardHandlerProviders); - for (ClipboardHandlerProvider provider : providers) { + for (ClipboardHandlerProvider provider : getClipboardHandlerProviders()) { if (provider.support(selection)) { selection = ((ClipboardHandlerProvider) provider).copy(selection); } @@ -52,15 +45,27 @@ public abstract class ClipboardFilter { } public static T paste(T selection) { - ExtraDesignClassManager manager = PluginModule.getAgent(PluginModule.ExtraDesign); - Set providers = manager.getArray(ClipboardHandlerProvider.XML_TAG); - providers.addAll(clipboardHandlerProviders); - - for (ClipboardHandlerProvider provider : providers) { + for (ClipboardHandlerProvider provider : getClipboardHandlerProviders()) { if (provider.support(selection)) { selection = ((ClipboardHandlerProvider) provider).paste(selection); } } return selection; } + + private static Set getClipboardHandlerProviders() { + Set providers = new HashSet<>(); + + for (ClipboardHandlerProvider clipboardHandlerProvider : clipboardHandlerProviders) { + providers.add(clipboardHandlerProvider); + } + + ExtraDesignClassManager manager = PluginModule.getAgent(PluginModule.ExtraDesign); + Set pluginProviders = manager.getArray(ClipboardHandlerProvider.XML_TAG); + for (ClipboardHandlerProvider clipboardHandlerProvider : pluginProviders) { + providers.add(clipboardHandlerProvider); + } + + return providers; + } } diff --git a/designer-base/src/main/java/com/fr/design/cell/CellRectangleStylePreviewPane.java b/designer-base/src/main/java/com/fr/design/cell/CellRectangleStylePreviewPane.java index 015fecee9d..c0b6a0bc85 100644 --- a/designer-base/src/main/java/com/fr/design/cell/CellRectangleStylePreviewPane.java +++ b/designer-base/src/main/java/com/fr/design/cell/CellRectangleStylePreviewPane.java @@ -15,6 +15,7 @@ import java.awt.Dimension; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.GridLayout; +import java.awt.Rectangle; import java.awt.RenderingHints; import java.awt.image.BufferedImage; @@ -46,7 +47,7 @@ public class CellRectangleStylePreviewPane extends JPanel { for (int r = 0; r < ROW_COUNT; r++) { for (int c = 0; c < COLUMN_COUNT; c++) { - CellStylePreviewPane pane = new CellStylePreviewPane(); + CellStylePreviewPane pane = new CellStylePreviewPane(c, r, COLUMN_COUNT, ROW_COUNT, false, false); TemplateCellElement cellElement = DefaultThemedTemplateCellElementCase.createInstance(c, r); int flags = CellBorderSourceFlag.INVALID_BORDER_SOURCE; if (supportInnerBorder) { @@ -136,6 +137,11 @@ public class CellRectangleStylePreviewPane extends JPanel { super.paint(g); } + @Override + public Rectangle getBounds() { + return super.getBounds(); + } + private void paintTransparentBackground(Graphics2D g2d, Style style) { float alpha = computeTransparentBackgroundAlpha(style); diff --git a/designer-base/src/main/java/com/fr/design/cell/CellStylePreviewPane.java b/designer-base/src/main/java/com/fr/design/cell/CellStylePreviewPane.java index b7e43c38cd..eb3c2cd7b5 100644 --- a/designer-base/src/main/java/com/fr/design/cell/CellStylePreviewPane.java +++ b/designer-base/src/main/java/com/fr/design/cell/CellStylePreviewPane.java @@ -7,6 +7,7 @@ import com.fr.base.ScreenResolution; import com.fr.base.Style; import com.fr.general.FRFont; import com.fr.general.IOUtils; +import com.fr.stable.Constants; import com.fr.stable.unit.PT; import javax.swing.JPanel; @@ -30,10 +31,29 @@ import java.util.List; public class CellStylePreviewPane extends JPanel { public static final int MINIMUM_HEIGHT = 40; + private static final BufferedImage transparentBackgroundImage = IOUtils.readImage("/com/fr/design/images/transparent_background.png"); + private final float transparentBackgroundWidth; + private final float transparentBackgroundHeight; private String paintText = "Report"; private Style style = Style.DEFAULT_STYLE; - public CellStylePreviewPane() { + private final int column; + private final int row; + private final int columnSpan; + private final int rowSpan; + + private final boolean autoClearCanvas; + private final boolean paintingMosaic; + + public CellStylePreviewPane(int column, int row, int columnSpan, int rowSpan, boolean autoClearCanvas, boolean paintingMosaic) { + this.column = column; + this.row = row; + this.columnSpan = columnSpan; + this.rowSpan = rowSpan; + this.autoClearCanvas = autoClearCanvas; + this.paintingMosaic = paintingMosaic; + transparentBackgroundWidth = transparentBackgroundImage.getWidth(null); + transparentBackgroundHeight = transparentBackgroundImage.getHeight(null); setPreferredSize(new Dimension(0, 0)); } @@ -55,15 +75,58 @@ public class CellStylePreviewPane extends JPanel { @Override public void paint(Graphics g) { Graphics2D g2d = (Graphics2D) g; + if (autoClearCanvas) { + g2d.clearRect(0, 0, getWidth(), getHeight()); + } g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); + if (paintingMosaic) { + paintTransparentBackground(g2d, style); + } + paintCellStyle(g2d, style); g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_OFF); } + private void paintTransparentBackground(Graphics2D g2d, Style style) { + float alpha = computeTransparentBackgroundAlpha(style); + + float scaleWidth = 1.0F * getWidth() / transparentBackgroundWidth; + float scaleHeight = 1.0F * getHeight() / transparentBackgroundHeight; + float maxScale = Math.max(scaleWidth, scaleHeight); + + if (maxScale <= 1) { + scaleWidth = scaleHeight = 1; + } else { + scaleHeight = scaleWidth = maxScale; + } + + Composite oldComposite = g2d.getComposite(); + g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_ATOP, alpha)); + g2d.drawImage(transparentBackgroundImage, 0, 0, (int) (transparentBackgroundWidth * scaleWidth), (int) (transparentBackgroundHeight * scaleHeight), null); + g2d.setComposite(oldComposite); + } + + private float computeTextColorBrightness(Style style) { + Color fontColor = style.getFRFont().getForeground(); + return fontColor.getRed() * 0.299F + fontColor.getGreen() * 0.587F + fontColor.getBlue() * 0.114F; + } + + private float computeTransparentBackgroundAlpha(Style style) { + float textBrightness = computeTextColorBrightness(style); + + float alpha = 1.0F; + if (textBrightness < 50) { + alpha = 0.2F; + } else if (textBrightness < 160){ + alpha = 0.5F; + } + return alpha; + } + private void paintCellStyle(Graphics2D g2d, Style style) { int resolution = ScreenResolution.getScreenResolution(); @@ -80,9 +143,42 @@ public class CellStylePreviewPane extends JPanel { Style.paintContent(g2d, paintText, style, width, height, resolution); - Style.paintBorder(g2d, style, - width - GraphHelper.getLineStyleSize(style.getBorderRight()) / 2F, - height - GraphHelper.getLineStyleSize(style.getBorderBottom()) / 2F); + paintCellBorder(g2d, style); + } + + protected void paintCellBorder(Graphics2D g2d, Style style) { + float adjustLeft = 0; + float adjustTop = 0; + float adjustRight = 0; + float adjustBottom = 0; + if (column == 0) { + adjustLeft = computeHalfSize4StyledBorder(style.getBorderLeft()); + } + if (row == 0) { + adjustTop = computeHalfSize4StyledBorder(style.getBorderTop()); + } + if (column == columnSpan - 1) { + adjustRight = -computeHalfSize4StyledBorder(style.getBorderRight()); + } + if (row == rowSpan - 1) { + adjustBottom = -computeHalfSize4StyledBorder(style.getBorderBottom()); + } + + g2d.translate(adjustLeft, adjustTop); + Style.paintBorder(g2d, style, getWidth() - adjustLeft + adjustRight, getHeight() - adjustTop + adjustBottom); + g2d.translate(-adjustLeft, -adjustTop); + } + + private float computeHalfSize4StyledBorder(int border) { + float size = GraphHelper.getLineStyleSize(border) / 2.0F; + + if (border == Constants.LINE_DOUBLE) { + size += GraphHelper.getLineStyleSize(Constants.LINE_THIN) / 2.0F; + } else if (border == Constants.LINE_DOUBLE_DOT) { + size += GraphHelper.getLineStyleSize(Constants.LINE_DOT) / 2.0F; + } + + return size; } @Override diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/TableDataPaneListPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/TableDataPaneListPane.java index 07d7abfb72..87e322b266 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/TableDataPaneListPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/TableDataPaneListPane.java @@ -17,9 +17,12 @@ import com.fr.event.EventDispatcher; import com.fr.file.ProcedureConfig; import com.fr.file.TableDataConfig; import com.fr.file.TableDataOperator; +import com.fr.file.TableDataOperatorImpl; import com.fr.general.ComparatorUtils; import com.fr.general.NameObject; import com.fr.log.FineLoggerFactory; +import com.fr.rpc.ExceptionHandler; +import com.fr.rpc.RPCInvokerExceptionInfo; import com.fr.stable.ArrayUtils; import com.fr.stable.Nameable; import com.fr.stable.StringUtils; @@ -246,7 +249,13 @@ public class TableDataPaneListPane extends JListControlPane implements TableData tableDataBeans.add(new TableDataBean(nameObject.getName(), oldName, (TableData) nameObject.getObject())); } try { - WorkContext.getCurrent().get(TableDataOperator.class).saveTableData(tableDataBeans); + WorkContext.getCurrent().get(TableDataOperator.class, new ExceptionHandler() { + @Override + public Object callHandler(RPCInvokerExceptionInfo exceptionInfo) { + // 走老的方式 + return saveByOldWay(tableDataBeans); + } + }).saveTableData(new ArrayList<>(tableDataConfig.getTableDatas().keySet()), tableDataBeans); if (!WorkContext.getCurrent().isLocal()) { EventDispatcher.fire(RemoteConfigEvent.EDIT, TableDataConfig.getInstance().getNameSpace()); } @@ -255,6 +264,15 @@ public class TableDataPaneListPane extends JListControlPane implements TableData } } + private boolean saveByOldWay(List tableDataBean) { + try { + return TableDataOperatorImpl.getInstance().saveTableData(tableDataBean); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + return false; + } + } + @Override public void update(TableDataSource tds) { tds.clearAllTableData(); diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java index 0c1967ef96..1566395edb 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java @@ -16,8 +16,11 @@ import com.fr.design.i18n.Toolkit; import com.fr.event.EventDispatcher; import com.fr.file.ConnectionConfig; import com.fr.file.ConnectionOperator; +import com.fr.file.ConnectionOperatorImpl; import com.fr.general.NameObject; import com.fr.log.FineLoggerFactory; +import com.fr.rpc.ExceptionHandler; +import com.fr.rpc.RPCInvokerExceptionInfo; import com.fr.stable.ArrayUtils; import com.fr.stable.Nameable; import com.fr.stable.StringUtils; @@ -170,7 +173,12 @@ public class ConnectionListPane extends JListControlPane implements ConnectionSh connectionBeans.add(new ConnectionBean(nameObject.getName(), oldName, (Connection) nameObject.getObject())); } try { - WorkContext.getCurrent().get(ConnectionOperator.class).saveConnection(connectionBeans); + WorkContext.getCurrent().get(ConnectionOperator.class, new ExceptionHandler() { + @Override + public Object callHandler(RPCInvokerExceptionInfo exceptionInfo) { + return saveByOldWay(connectionBeans); + } + }).saveConnection(new ArrayList<>(connectionConfig.getConnections().keySet()), connectionBeans); if (!WorkContext.getCurrent().isLocal()) { EventDispatcher.fire(RemoteConfigEvent.EDIT, ConnectionConfig.getInstance().getNameSpace()); } @@ -179,6 +187,15 @@ public class ConnectionListPane extends JListControlPane implements ConnectionSh } } + private boolean saveByOldWay(List connectionBeans) { + try { + return ConnectionOperatorImpl.getInstance().saveConnection(connectionBeans); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + return false; + } + } + public static void showDialog(Window parent) { final ConnectionConfig connectionConfig = ConnectionConfig.getInstance(); final ConnectionManagerPane connectionManagerPane = new ConnectionManagerPane() { 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 173da2fbf7..1746330f11 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 @@ -715,8 +715,8 @@ public class DBTableDataPane extends AbstractTableDataPane { if (useGlobal(getTableData(), strategyConfig)) { //使用全局配置 strategyConfig = StrategyConfigHelper.createStrategyConfig(true); - } else if (getTableData().isShare()) { - //使用共享数据集兼容配置 + } else if (strategyConfig == null && getTableData().isShare()) { + //没有配置时,使用共享数据集兼容配置 strategyConfig = StrategyConfigHelper.createStrategyConfig(true, false, true); } } diff --git a/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java b/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java index 920ecb78c8..443a55671d 100644 --- a/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java +++ b/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java @@ -15,7 +15,6 @@ import com.fr.design.mainframe.JVirtualTemplate; import com.fr.design.ui.util.UIUtil; import com.fr.file.FILE; import com.fr.file.FileNodeFILE; -import com.fr.file.StashedFILE; import com.fr.general.ComparatorUtils; import com.fr.invoke.ClassHelper; import com.fr.log.FineLoggerFactory; @@ -25,7 +24,7 @@ import com.fr.stable.CoreConstants; import com.fr.stable.StringUtils; import com.fr.third.org.apache.commons.io.FilenameUtils; -import java.io.ByteArrayOutputStream; +import javax.swing.SwingWorker; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; @@ -33,7 +32,6 @@ import java.util.List; import java.util.ListIterator; import java.util.Map; import java.util.Set; -import javax.swing.SwingWorker; /** * 历史模板缓存 @@ -364,7 +362,7 @@ public class HistoryTemplateListCache implements CallbackEvent { int size = historyList.size(); for (int i = 0; i < size; i++) { JTemplate template = historyList.get(i); - FILE file = templateToStashFile(template); + FILE file = template.templateToStashFile(); if (file != null) { stashFILEMap.put(i, file); } @@ -372,21 +370,6 @@ public class HistoryTemplateListCache implements CallbackEvent { FineLoggerFactory.getLogger().info("Env Change Template Stashed."); } - private FILE templateToStashFile(JTemplate template) { - FILE file = template.getEditingFILE(); - try { - ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); - BaseBook target = template.getTarget(); - if (target != null) { - target.export(outputStream); - return new StashedFILE(file, outputStream.toByteArray(), template.suffix()); - } - // 如果 target == null 那么这个模板是被模板内存优化功能处理过的,不用处理 - } catch (Exception e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); - } - return null; - } private boolean checkStash() { try { @@ -469,7 +452,7 @@ public class HistoryTemplateListCache implements CallbackEvent { FILE file = template.getEditingFILE(); boolean needReload = context == null || needReloadTemplate(context, template); if (needReload) { - FILE stashFile = templateToStashFile(template); + FILE stashFile = template.templateToStashFile(); if (stashFile != null) { FineLoggerFactory.getLogger().info("{} is being reloaded", file.getName()); template.refreshResource(stashFile); diff --git a/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java b/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java index 74bf3fe76f..795ff721f0 100644 --- a/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java +++ b/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java @@ -555,6 +555,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { private void fixFunctionNameList(String functionName) { int signOfContinue = 1; int indexOfFunction = 0; + boolean found = false; for (int i = 0; i < functionTypeListModel.size(); i++) { int signOfType = 0; FunctionGroup functionType = (FunctionGroup) functionTypeListModel.getElementAt(i); @@ -568,6 +569,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { signOfType = 1; signOfContinue = 0; indexOfFunction = k; + found = true; } } @@ -577,8 +579,12 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { } } } - functionNameList.setSelectedIndex(indexOfFunction); - functionNameList.ensureIndexIsVisible(indexOfFunction); + if (found) { + functionNameList.setSelectedIndex(indexOfFunction); + functionNameList.ensureIndexIsVisible(indexOfFunction); + } else { + functionTypeList.setSelectedIndex(0); + } } private int getBeginPosition() { @@ -808,10 +814,11 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { String formulaText = formulaTextArea.getText().trim(); String unSupportFormula = containsUnsupportedSimulationFormulas(formulaText); if (unSupportFormula != null) { - showMessageDialog(Toolkit.i18nText("Fine-Design_Basic_Formula_Unsupported_Formulas") + ":" + unSupportFormula, false); + showMessageDialog(Toolkit.i18nText("Fine-Design_Basic_Formula_Unsupported_Formulas") + ":" + unSupportFormula, false, true); return; } + boolean calException = false; String messageTips; FormulaCheckResult checkResult = FormulaChecker.check(formulaText); if (checkResult.grammarValid()) { @@ -840,6 +847,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { } catch (Exception ce) { //模拟计算如果出现错误,则抛出错误 calResult = ce.getMessage(); + calException = true; FineLoggerFactory.getLogger().error(ce.getMessage(), ce); messageTips = messageTips + Toolkit.i18nText("Fine-Design_Basic_Formula_Cal_Error") + ":" + calResult; } @@ -848,7 +856,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { messageTips = checkResult.getTips(); } if (checkResult.isValid()) { - showMessageDialog(messageTips, checkResult.isValid()); + showMessageDialog(messageTips, checkResult.isValid(), calException); } else { confirmCheckResult(checkResult, messageTips); } @@ -865,10 +873,14 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { private boolean confirmCheckResult(FormulaCheckResult checkResult, String messageTips) { if (checkResult.isValid()) { - showMessageDialog(checkResult.getTips(), checkResult.isValid()); + showMessageDialog(checkResult.getTips(), checkResult.isValid(), false); } else { - String position = Toolkit.i18nText("Fine-Design_Basic_Formula_The") + (checkResult.getFormulaCoordinates().getColumns()) - + Toolkit.i18nText("Fine-Design_Basic_Formula_Error_Position") + " "; + int columns = checkResult.getFormulaCoordinates().getColumns(); + String position = StringUtils.EMPTY; + if (columns >= 0) { + position = Toolkit.i18nText("Fine-Design_Basic_Formula_The") + columns + + Toolkit.i18nText("Fine-Design_Basic_Formula_Error_Position") + " "; + } int confirmDialog = FineJOptionPane.showConfirmDialog( FormulaPane.this, position + messageTips, @@ -879,7 +891,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { new String[]{Toolkit.i18nText("Fine-Design_Basic_Formula_Check_Result"), Toolkit.i18nText("Fine-Design_Basic_Formula_Continue")}, Toolkit.i18nText("Fine-Design_Basic_Formula_Check_Result")); if (confirmDialog == 0) { - formulaTextArea.setCaretPosition(checkResult.getFormulaCoordinates().getColumns()); + formulaTextArea.setCaretPosition(Math.max(columns, 0)); formulaTextArea.requestFocus(); return false; } @@ -887,8 +899,8 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { return true; } - private void showMessageDialog(String message, boolean formulaValid) { - if (formulaValid) { + private void showMessageDialog(String message, boolean formulaValid, boolean calException) { + if (formulaValid && !calException) { FineJOptionPane.showMessageDialog( FormulaPane.this, message); diff --git a/designer-base/src/main/java/com/fr/design/formula/exception/function/FormulaCheckWrongFunction.java b/designer-base/src/main/java/com/fr/design/formula/exception/function/FormulaCheckWrongFunction.java index ce2b7cb52b..417e9b37a6 100644 --- a/designer-base/src/main/java/com/fr/design/formula/exception/function/FormulaCheckWrongFunction.java +++ b/designer-base/src/main/java/com/fr/design/formula/exception/function/FormulaCheckWrongFunction.java @@ -73,6 +73,8 @@ public class FormulaCheckWrongFunction implements FunctionD:\finereport\develop\code\test\TestCase\WEB-INF\reportlets\TestCase\01903.cpt + *

+ * Extensions are of the type ".foo", which is typically found on + * Windows and Unix boxes, but not on Macinthosh. Case is ignored. + *

+ * Example - create a new filter that filerts out all files + * but gif and jpg image files: + *

+ * JFileChooser chooser = new JFileChooser(); + * ExampleFileFilter filter = new ExampleFileFilter( + * new String{"gif", "jpg"}, "JPEG & GIF Images") + * chooser.addChoosableFileFilter(filter); + * chooser.showOpenDialog(this); + * + * @author Jeff Dinkins + * @version 1.12 12/03/01 + */ + class ExampleFileFilter extends FileFilter { + private Hashtable filters = null; + private String description = null; + private String fullDescription = null; + private boolean useExtensionsInDescription = true; + + /** + * Creates a file filter. If no filters are added, then all + * files are accepted. + * + * @see #addExtension + */ + public ExampleFileFilter() { + this.filters = new Hashtable(); + } + + /** + * Creates a file filter that accepts files with the given extension. + * Example: new ExampleFileFilter("jpg"); + * + * @see #addExtension + */ + public ExampleFileFilter(String extension) { + this(extension, null); + } + + /** + * Creates a file filter that accepts the given file type. + * Example: new ExampleFileFilter("jpg", "JPEG Image Images"); + *

+ * Note that the "." before the extension is not needed. If + * provided, it will be ignored. + * + * @see #addExtension + */ + public ExampleFileFilter(String extension, String description) { + this(); + if (extension != null) addExtension(extension); + if (description != null) setDescription(description); + } + + /** + * Creates a file filter from the given string array. + * Example: new ExampleFileFilter(String {"gif", "jpg"}); + *

+ * Note that the "." before the extension is not needed adn + * will be ignored. + * + * @see #addExtension + */ + public ExampleFileFilter(String[] filters) { + this(filters, null); + } + + /** + * Creates a file filter from the given string array and description. + * Example: new ExampleFileFilter(String {"gif", "jpg"}, "Gif and JPG Images"); + *

+ * Note that the "." before the extension is not needed and will be ignored. + * + * @see #addExtension + */ + public ExampleFileFilter(String[] filters, String description) { + this(); + for (int i = 0; i < filters.length; i++) { + // add filters one by one + addExtension(filters[i]); + } + if (description != null) setDescription(description); + } + + /** + * Return true if this file should be shown in the directory pane, + * false if it shouldn't. + *

+ * Files that begin with "." are ignored. + * + * @see #getExtension + */ + @Override + public boolean accept(File f) { + if (f != null) { + if (f.isDirectory()) { + return true; + } + String extension = getExtension(f); + if (extension != null && filters.get(getExtension(f)) != null) { + return true; + } + } + return false; + } + + /** + * Return the extension portion of the file's name . + * + * @see #getExtension + * @see FileFilter#accept + */ + public String getExtension(File f) { + if (f != null) { + String filename = f.getName(); + int i = filename.lastIndexOf('.'); + if (i > 0 && i < filename.length() - 1) { + return filename.substring(i + 1).toLowerCase(); + } + } + return null; + } + + /** + * Adds a filetype "dot" extension to filter against. + *

+ * For example: the following code will create a filter that filters + * out all files except those that end in ".jpg" and ".tif": + *

+ * ExampleFileFilter filter = new ExampleFileFilter(); + * filter.addExtension("jpg"); + * filter.addExtension("tif"); + *

+ * Note that the "." before the extension is not needed and will be ignored. + */ + public void addExtension(String extension) { + if (filters == null) { + filters = new Hashtable(5); + } + filters.put(extension.toLowerCase(), this); + fullDescription = null; + } + + + /** + * Returns the human readable description of this filter. For + * example: "JPEG and GIF Image Files (*.jpg, *.gif)" + * + * @see FileFilter#getDescription + */ + @Override + public String getDescription() { + if (fullDescription == null) { + if (description == null || isExtensionListInDescription()) { + fullDescription = description == null ? "(" : description + " ("; + // build the description from the extension list + Enumeration extensions = filters.keys(); + if (extensions != null) { + fullDescription += "." + extensions.nextElement(); + while (extensions.hasMoreElements()) { + fullDescription += ", ." + extensions.nextElement(); + } + } + fullDescription += ")"; + } else { + fullDescription = description; + } + } + return fullDescription; + } + + /** + * Sets the human readable description of this filter. For + * example: filter.setDescription("Gif and JPG Images"); + */ + public void setDescription(String description) { + this.description = description; + fullDescription = null; + } + + /** + * Determines whether the extension list (.jpg, .gif, etc) should + * show up in the human readable description. + *

+ * Only relevent if a description was provided in the constructor + * or using setDescription(); + */ + public void setExtensionListInDescription(boolean b) { + useExtensionsInDescription = b; + fullDescription = null; + } + + /** + * Returns whether the extension list (.jpg, .gif, etc) should + * show up in the human readable description. + *

+ * Only relevent if a description was provided in the constructor + * or using setDescription(); + */ + public boolean isExtensionListInDescription() { + return useExtensionsInDescription; + } + } + +} diff --git a/designer-base/src/main/java/com/fr/design/gui/style/BorderPane.java b/designer-base/src/main/java/com/fr/design/gui/style/BorderPane.java index dcead1c878..3c917ea456 100644 --- a/designer-base/src/main/java/com/fr/design/gui/style/BorderPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/style/BorderPane.java @@ -4,7 +4,6 @@ package com.fr.design.gui.style; * Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. */ -import com.fr.base.BaseUtils; import com.fr.base.CellBorderStyle; import com.fr.base.Style; import com.fr.design.constants.LayoutConstants; @@ -17,8 +16,8 @@ import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.style.color.NewColorSelectBox; -import com.fr.general.IOUtils; import com.fr.design.utils.gui.AdjustWorkBookDefaultStyleUtils; +import com.fr.general.IOUtils; import com.fr.stable.Constants; import com.fr.stable.CoreConstants; @@ -206,6 +205,8 @@ public class BorderPane extends AbstractBasicStylePane implements GlobalNameObse } public void populateLineStyleAndColor(CellBorderStyle cellBorderStyle, boolean onlyInspectTop) { + resetLineStyleAndColorSetting(); + if (cellBorderStyle.getTopStyle() != Constants.LINE_NONE) { this.currentLineCombo.setSelectedLineStyle(cellBorderStyle.getTopStyle()); this.currentLineColorPane.setSelectObject(cellBorderStyle.getTopColor()); @@ -225,9 +226,6 @@ public class BorderPane extends AbstractBasicStylePane implements GlobalNameObse } else if (cellBorderStyle.getHorizontalStyle() != Constants.LINE_NONE) { this.currentLineCombo.setSelectedLineStyle(cellBorderStyle.getHorizontalStyle()); this.currentLineColorPane.setSelectObject(cellBorderStyle.getHorizontalColor()); - } else { - this.currentLineCombo.setSelectedLineStyle(Constants.LINE_NONE); - this.currentLineColorPane.setSelectObject(Color.BLACK); } } @@ -236,6 +234,11 @@ public class BorderPane extends AbstractBasicStylePane implements GlobalNameObse } } + private void resetLineStyleAndColorSetting() { + this.currentLineCombo.setSelectedLineStyle(Constants.LINE_NONE); + this.currentLineColorPane.setSelectObject(null); + } + @Override public Style update(Style style) { diff --git a/designer-base/src/main/java/com/fr/design/lock/LockInfoDialog.java b/designer-base/src/main/java/com/fr/design/lock/LockInfoDialog.java index 71c9549248..a0fd544d53 100644 --- a/designer-base/src/main/java/com/fr/design/lock/LockInfoDialog.java +++ b/designer-base/src/main/java/com/fr/design/lock/LockInfoDialog.java @@ -3,6 +3,7 @@ package com.fr.design.lock; import com.fr.design.file.TemplateTreePane; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ilable.UILabel; +import com.fr.design.i18n.DesignSizeI18nManager; import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.DesignerContext; @@ -44,7 +45,7 @@ public class LockInfoDialog extends JDialog { panel.add(createControlPane(), BorderLayout.SOUTH); this.getContentPane().add(panel); this.setTitle(Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Title_Hint")); - this.setSize(400, 160); + this.setSize(DesignSizeI18nManager.getInstance().i18nDimension("com.fr.design.lock.LockInfoDialog")); this.setResizable(false); this.setModal(true); GUICoreUtils.centerWindow(this); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/ForbiddenPane.java b/designer-base/src/main/java/com/fr/design/mainframe/ForbiddenPane.java index f903912115..9c33534c7b 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/ForbiddenPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/ForbiddenPane.java @@ -2,6 +2,7 @@ package com.fr.design.mainframe; import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.gui.ilable.UILabel; +import com.fr.design.i18n.DesignSizeI18nManager; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.guide.base.GuideView; import com.fr.design.utils.gui.GUICoreUtils; @@ -105,7 +106,7 @@ public class ForbiddenPane extends JPanel { super.paintComponent(g2d); } }; - refreshButton.setPreferredSize(new Dimension(68, 24)); + refreshButton.setPreferredSize(DesignSizeI18nManager.getInstance().i18nDimension("com.fr.design.mainframe.ForbiddenPane.refreshButton")); refreshButton.setForeground(Color.WHITE); refreshButton.setBorderPainted(false); refreshButton.setContentAreaFilled(false); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java b/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java index 26a2f64bca..f1a40ccdc7 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java @@ -65,6 +65,7 @@ import com.fr.event.EventDispatcher; import com.fr.file.FILE; import com.fr.file.FILEChooserPane; import com.fr.file.MemFILE; +import com.fr.file.StashedFILE; import com.fr.form.ui.NoneWidget; import com.fr.form.ui.Widget; import com.fr.general.ComparatorUtils; @@ -104,6 +105,7 @@ import javax.swing.JOptionPane; import javax.swing.SwingConstants; import javax.swing.undo.UndoManager; import java.awt.BorderLayout; +import java.io.ByteArrayOutputStream; import java.awt.Dimension; import java.awt.FontMetrics; import java.util.Set; @@ -438,6 +440,22 @@ public abstract class JTemplate> stopListenThemeConfig(); } + public FILE templateToStashFile() { + FILE file = this.getEditingFILE(); + try { + ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); + BaseBook target = this.getTarget(); + if (target != null) { + target.export(outputStream); + return new StashedFILE(file, outputStream.toByteArray(), template.suffix()); + } + // 如果 target == null 那么这个模板是被模板内存优化功能处理过的,不用处理 + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + return null; + } + /** * 刷新内部资源 @@ -967,6 +985,7 @@ public abstract class JTemplate> return false; } try { + checkBeforeSave(); export(); } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); @@ -985,7 +1004,7 @@ public abstract class JTemplate> return isNewCreateTpl; } - protected boolean export() throws Exception { + protected void checkBeforeSave() throws Exception { // 保存前校验下未解锁 if (WorkContext.getCurrent().get(LockInfoOperator.class).isTplUnLocked(getEditingFILE().getPath())) { throw new UnLockedException(); @@ -994,6 +1013,9 @@ public abstract class JTemplate> if (getEditingFILE().exists() && !WorkContext.getCurrent().get(LockInfoOperator.class).isConsistentLock(getEditingFILE().getPath())) { throw new InconsistentLockException(); } + } + + protected boolean export() throws Exception { return this.getTarget().export(TemplateResourceManager.getResource().saveTemplate(getEditingFILE())); } @@ -1634,6 +1656,7 @@ public abstract class JTemplate> if (editingFILE == null || editingFILE instanceof MemFILE) { return false; } + checkBeforeSave(); export(); this.editingFILE = editingFILE; return true; diff --git a/designer-base/src/main/java/com/fr/design/mainframe/theme/edit/CellStyleListEditPane.java b/designer-base/src/main/java/com/fr/design/mainframe/theme/edit/CellStyleListEditPane.java index 0b5c7b61e7..3f198f230a 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/theme/edit/CellStyleListEditPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/theme/edit/CellStyleListEditPane.java @@ -30,9 +30,11 @@ import com.fr.stable.Nameable; import com.fr.stable.StringUtils; import javax.swing.BorderFactory; +import javax.swing.DefaultListModel; import javax.swing.JList; import javax.swing.JOptionPane; import javax.swing.JPanel; +import javax.swing.ListModel; import javax.swing.SwingUtilities; import java.awt.BorderLayout; import java.awt.Component; @@ -101,7 +103,7 @@ public class CellStyleListEditPane extends JListControlPane { @Override protected JNameEdList createJNameList() { - JNameEdList nameEdList = super.createJNameList(); + JNameEdList nameEdList = new NoIconNamedList(new DefaultListModel()); nameEdList.setCellEditor(new UnEditableListCellEditor(new UITextField())); nameEdList.setCellRenderer(new NoIconNameableListCellRenderer()); return nameEdList; @@ -294,6 +296,17 @@ public class CellStyleListEditPane extends JListControlPane { return component; } } + private class NoIconNamedList extends JNameEdList { + + public NoIconNamedList(ListModel dataModel) { + super(dataModel); + } + + @Override + public int getIconWidth() { + return 0; + } + } private class UnEditableListCellEditor extends DefaultListCellEditor { public UnEditableListCellEditor(UITextField textField) { diff --git a/designer-base/src/main/java/com/fr/design/mainframe/theme/edit/cell/CellStyleEditPane.java b/designer-base/src/main/java/com/fr/design/mainframe/theme/edit/cell/CellStyleEditPane.java index 8efbb1eee5..846da26491 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/theme/edit/cell/CellStyleEditPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/theme/edit/cell/CellStyleEditPane.java @@ -88,13 +88,13 @@ public class CellStyleEditPane extends MultiTabPane { @Override public ThemedCellStyle updateBean() { - AbstractBasicStylePane basicStylePane = (AbstractBasicStylePane) paneList.get(tabPane.getSelectedIndex()); - Style style = basicStylePane.update(this.cellStyle.getStyle()); + Style style = this.cellStyle.getStyle(); CellBorderStyle borderStyle = createDefaultBorderStyleFromStyle(style); - - - if (ThemedFeatureController.isCellStyleSupportInnerBorder() && basicStylePane instanceof BorderPane) { - borderStyle = ((BorderPane) basicStylePane).update(); + for (BasicPane basicPane : paneList) { + style = ((AbstractBasicStylePane) basicPane).update(style); + if (ThemedFeatureController.isCellStyleSupportInnerBorder() && basicPane instanceof BorderPane) { + borderStyle = ((BorderPane) basicPane).update(); + } } this.cellStyle.setStyle(style); @@ -198,7 +198,7 @@ public class CellStyleEditPane extends MultiTabPane { @Override protected void layoutContentPane() { super.layoutContentPane(); - leftcontentPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); + leftcontentPane.setBorder(BorderFactory.createMatteBorder(0, 0, 0, 5, original)); } } } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/theme/edit/chart/ChartFontPane.java b/designer-base/src/main/java/com/fr/design/mainframe/theme/edit/chart/ChartFontPane.java index 84a615f61f..2b19b232e3 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/theme/edit/chart/ChartFontPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/theme/edit/chart/ChartFontPane.java @@ -7,7 +7,6 @@ import com.fr.design.constants.LayoutConstants; import com.fr.design.dialog.BasicPane; import com.fr.design.event.UIObserverListener; import com.fr.design.gui.ibutton.UIColorButton; -import com.fr.design.gui.ibutton.UIColorButtonWithAuto; import com.fr.design.gui.ibutton.UIToggleButton; import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.ilable.UILabel; @@ -57,7 +56,11 @@ public class ChartFontPane extends BasicPane { fontSizeComboBox = new UIComboBox(FONT_SIZES); bold = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/bold.png")); italic = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/italic.png")); - fontColor = new UIColorButtonWithAuto(); + fontColor = getColorButton(); + } + + protected UIColorButton getColorButton() { + return new UIColorButton(); } protected void initComponents() { diff --git a/designer-base/src/main/java/com/fr/design/mainframe/theme/edit/chart/ChartLabelStylePane.java b/designer-base/src/main/java/com/fr/design/mainframe/theme/edit/chart/ChartLabelStylePane.java index 8eb736444f..c94dd6ef22 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/theme/edit/chart/ChartLabelStylePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/theme/edit/chart/ChartLabelStylePane.java @@ -2,6 +2,8 @@ package com.fr.design.mainframe.theme.edit.chart; import com.fr.base.theme.settings.ThemedChartStyle; import com.fr.design.gui.ibutton.UIButtonGroup; +import com.fr.design.gui.ibutton.UIColorButton; +import com.fr.design.gui.ibutton.UIColorButtonWithAuto; import com.fr.design.gui.ilable.UILabel; import com.fr.design.i18n.Toolkit; @@ -25,6 +27,11 @@ public class ChartLabelStylePane extends AbstractChartStylePane { autoButton = new UIButtonGroup<>(new String[]{Toolkit.i18nText("Fine-Design_Chart_Auto"), Toolkit.i18nText("Fine-Design_Chart_Custom")}); chartFontPane = new ChartFontPane() { + @Override + protected UIColorButton getColorButton() { + return new UIColorButtonWithAuto(); + } + public String getUILabelText() { return Toolkit.i18nText("Fine-Design_Chart_Label_Character"); } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ecpreview/cell/AbstractPreviewCell.java b/designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ecpreview/cell/AbstractPreviewCell.java index fdd4dd3ca2..cfecccd61a 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ecpreview/cell/AbstractPreviewCell.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ecpreview/cell/AbstractPreviewCell.java @@ -40,6 +40,7 @@ public abstract class AbstractPreviewCell extends JComponent { if (style.getBorderBottom() == Constants.LINE_SLIM || style.getBorderTop() == Constants.LINE_SLIM) { height -= BORDER_INSET; } + g2d.setClip(null); Style.paintBorder(g2d, style, width, height); } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/toast/ToastMsgDialog.java b/designer-base/src/main/java/com/fr/design/mainframe/toast/ToastMsgDialog.java index b4c6dc1b51..83cd84e9cc 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/toast/ToastMsgDialog.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/toast/ToastMsgDialog.java @@ -3,6 +3,7 @@ package com.fr.design.mainframe.toast; import com.fr.concurrent.NamedThreadFactory; import com.fr.design.dialog.UIDialog; import com.fr.design.mainframe.DesignerContext; +import com.fr.design.mainframe.DesignerFrame; import com.fr.module.ModuleContext; import javax.swing.JPanel; @@ -51,12 +52,16 @@ public class ToastMsgDialog extends UIDialog { hide_height = dimension.height; setSize(new Dimension(dimension.width, 0)); contentPane.setSize(dimension); - setLocationRelativeTo(DesignerContext.getDesignerFrame().getContentFrame()); - int positionY = DesignerContext.getDesignerFrame().getContentFrame().getLocationOnScreen().y + 10; - setLocation((DesignerContext.getDesignerFrame().getWidth() - dimension.width) / 2, positionY); + setRelativeLocation(dimension); addMouseEvent(contentPane); } + private void setRelativeLocation(Dimension dimension) { + DesignerFrame designerFrame = DesignerContext.getDesignerFrame(); + int positionX = designerFrame.getLocationOnScreen().x + (designerFrame.getWidth() - dimension.width) / 2; + int positionY = designerFrame.getContentFrame().getLocationOnScreen().y + 10; + this.setLocation(positionX, positionY); + } private Dimension calculatePreferSize() { Dimension contentDimension = contentPane.getPreferredSize(); @@ -106,7 +111,7 @@ public class ToastMsgDialog extends UIDialog { Dimension dimension = ToastMsgDialog.this.getSize(); ToastMsgDialog.this.setSize(new Dimension(dimension.width, dimension.height - 5)); } - }, 0,50, TimeUnit.MILLISECONDS); + }, 0, 50, TimeUnit.MILLISECONDS); } }, 5000, TimeUnit.MILLISECONDS); diff --git a/designer-base/src/main/java/com/fr/design/os/impl/PMDialogAction.java b/designer-base/src/main/java/com/fr/design/os/impl/PMDialogAction.java index 990e73ee9c..16944da068 100644 --- a/designer-base/src/main/java/com/fr/design/os/impl/PMDialogAction.java +++ b/designer-base/src/main/java/com/fr/design/os/impl/PMDialogAction.java @@ -1,6 +1,7 @@ package com.fr.design.os.impl; import com.fr.config.ServerPreferenceConfig; +import com.fr.design.DesignerEnvManager; import com.fr.design.extra.WebViewDlgHelper; import com.fr.design.jdk.JdkVersion; import com.fr.design.upm.UpmFinder; @@ -23,7 +24,9 @@ public class PMDialogAction implements OSBasedAction { DesignUtils.visitEnvServerByParameters( PLUGIN_MANAGER_ROUTE,null,null); return; } - if (ServerPreferenceConfig.getInstance().isUseOptimizedUPM() || SupportOSImpl.MACOS_NEW_PLUGIN_MANAGEMENT.support()) { + if (ServerPreferenceConfig.getInstance().isUseOptimizedUPM() + || SupportOSImpl.MACOS_NEW_PLUGIN_MANAGEMENT.support() + || DesignerEnvManager.getEnvManager().isUseOptimizedUPM4Adapter()) { UpmFinder.showUPMDialog(); } else { WebViewDlgHelper.createPluginDialog(); diff --git a/designer-base/src/main/java/com/fr/design/os/impl/SupportOSImpl.java b/designer-base/src/main/java/com/fr/design/os/impl/SupportOSImpl.java index e8871154e6..5751c3ecb9 100644 --- a/designer-base/src/main/java/com/fr/design/os/impl/SupportOSImpl.java +++ b/designer-base/src/main/java/com/fr/design/os/impl/SupportOSImpl.java @@ -8,13 +8,18 @@ import com.fr.general.GeneralContext; import com.fr.json.JSON; import com.fr.json.JSONFactory; import com.fr.json.JSONObject; +import com.fr.log.FineLoggerFactory; import com.fr.stable.StringUtils; import com.fr.stable.os.Arch; import com.fr.stable.os.OperatingSystem; import com.fr.stable.os.support.SupportOS; import com.fr.workspace.WorkContext; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.List; import java.util.Locale; +import java.util.Scanner; /** * @author pengda @@ -143,6 +148,45 @@ public enum SupportOSImpl implements SupportOS { } }, + OLD_STYLE_CHOOSER { + + @Override + public boolean support() { + return (OperatingSystem.isLinux() && Arch.getArch() == Arch.ARM) || MACOS_12_VERSION_ADAPTER.support(); + } + }, + + MACOS_12_VERSION_ADAPTER { + @Override + public boolean support() { + return (OperatingSystem.isMacos() && getMacOsVersionNumber() >= macosMontereyVersionNum); + } + + private final int macosMontereyVersionNum = 12; + + /** + * System.getProperty("os.version") 在最新macos版本存在bug + * https://bugs.openjdk.java.net/browse/JDK-8253702 + * + * @return + */ + private int getMacOsVersionNumber() { + String result; + List command = new ArrayList<>(); + command.add("/usr/bin/sw_vers"); + command.add("-productVersion"); + try (InputStream inputStream = new ProcessBuilder(command).start().getInputStream(); + Scanner s = new Scanner(inputStream).useDelimiter("\\A")) { + result = s.hasNext() ? s.next() : StringUtils.EMPTY; + String[] versionSlice = result.split("\\."); + return Integer.parseInt(versionSlice[0]); + } catch (Exception e) { + FineLoggerFactory.getLogger().warn(e.getMessage(), e); + return 0; + } + } + }, + DESIGNER_LOGIN { @Override public boolean support() { diff --git a/designer-base/src/main/java/com/fr/design/report/WatermarkSettingPane.java b/designer-base/src/main/java/com/fr/design/report/WatermarkSettingPane.java index 0cc211c5f1..f3de6eef96 100644 --- a/designer-base/src/main/java/com/fr/design/report/WatermarkSettingPane.java +++ b/designer-base/src/main/java/com/fr/design/report/WatermarkSettingPane.java @@ -1,5 +1,6 @@ package com.fr.design.report; +import com.fr.base.iofile.attr.WaterMarkProvideConstant; import com.fr.base.iofile.attr.WatermarkAttr; import com.fr.design.dialog.AbstractTemplateServerSettingPane; import com.fr.report.core.ReportUtils; @@ -33,6 +34,7 @@ public class WatermarkSettingPane extends AbstractTemplateServerSettingPane { @Override protected void populateServerSettings() { WatermarkAttr watermarkAttr = ReportUtils.getWatermarkAttrFromServerConfig(); + watermarkAttr.setValid(true); watermarkPane.populate(watermarkAttr); } @@ -42,20 +44,21 @@ public class WatermarkSettingPane extends AbstractTemplateServerSettingPane { } public void populate(WatermarkAttr watermark) { - if (!watermark.isValid()) { + if (watermark.getWaterMarkProvider().equals(WaterMarkProvideConstant.TEMPLATE)) { + chooseComboBox.setSelectedIndex(SINGLE_SET); + watermarkPane.populate(watermark); + } else { chooseComboBox.setSelectedIndex(SERVER_SET); populateServerSettings(); - return; } - chooseComboBox.setSelectedIndex(SINGLE_SET); - watermarkPane.populate(watermark); } public WatermarkAttr update() { WatermarkAttr watermark = watermarkPane.update(); - if (isUsingServerSettings()) { - watermark.setValid(false); + if (!isUsingServerSettings()) { + watermark.setValid(true); + watermark.setWaterMarkProvider(WaterMarkProvideConstant.TEMPLATE); } return watermark; } diff --git a/designer-base/src/main/java/com/fr/design/style/background/image/ImageFileChooser.java b/designer-base/src/main/java/com/fr/design/style/background/image/ImageFileChooser.java index 9c5b1af4d1..739dc81d55 100644 --- a/designer-base/src/main/java/com/fr/design/style/background/image/ImageFileChooser.java +++ b/designer-base/src/main/java/com/fr/design/style/background/image/ImageFileChooser.java @@ -4,62 +4,47 @@ package com.fr.design.style.background.image; import com.fr.design.DesignerEnvManager; -import com.fr.design.gui.ifilechooser.FileSelectionMode; -import com.fr.design.gui.ifilechooser.JavaFxNativeFileChooser; -import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.ifilechooser.FileChooserFactory; +import com.fr.design.gui.ifilechooser.FileChooserProvider; import com.fr.design.i18n.Toolkit; -import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.mainframe.share.collect.ComponentCollector; import com.fr.design.mainframe.toast.DesignerToastMsgUtil; -import javafx.stage.FileChooser; -import javax.swing.*; -import java.awt.*; -import java.awt.event.MouseEvent; -import java.awt.event.MouseListener; + +import java.awt.Component; import java.io.File; +import javax.swing.SwingUtilities; /** * This class used to choose image files. */ public class ImageFileChooser { - - JavaFxNativeFileChooser javaFxNativeFileChooser; + private final FileChooserProvider fileChooserProvider; public ImageFileChooser() { - javaFxNativeFileChooser = - new JavaFxNativeFileChooser.Builder(). - fileSelectionMode(FileSelectionMode.FILE). - title(Toolkit.i18nText("Fine-Design_Basic_Open")). - filter(Toolkit.i18nText("Fine-Design_Basic_Image_Image_Files"), "*.jpg", "*.gif", "*.png", "*.bmp"). - build(); + fileChooserProvider = FileChooserFactory.createImageFileChooser(); } public int showOpenDialog(Component parent, String approveButtonText) { - return showOpenDialog(parent); + return fileChooserProvider.showOpenDialog(parent, approveButtonText); } public int showOpenDialog(Component parent) { showImageCompressMoveTip(); - return javaFxNativeFileChooser.showDialog(parent); + return fileChooserProvider.showDialog(parent); } public void setCurrentDirectory(File file) { - javaFxNativeFileChooser.setCurrentDirectory(file); + fileChooserProvider.setCurrentDirectory(file); } public void setMultiSelectionEnabled(boolean multiple) { - if (multiple) { - javaFxNativeFileChooser.setSelectionMode(FileSelectionMode.MULTIPLE_FILE); - } else { - javaFxNativeFileChooser.setSelectionMode(FileSelectionMode.FILE); - } + fileChooserProvider.setMultiSelectionEnabled(multiple); } public File getSelectedFile() { - return javaFxNativeFileChooser.getSelectedFile(); + return fileChooserProvider.getSelectedFile(); } public boolean isCheckSelected() { diff --git a/designer-base/src/main/java/com/fr/design/upm/UpmBridge.java b/designer-base/src/main/java/com/fr/design/upm/UpmBridge.java index fee07ac467..01369116d7 100644 --- a/designer-base/src/main/java/com/fr/design/upm/UpmBridge.java +++ b/designer-base/src/main/java/com/fr/design/upm/UpmBridge.java @@ -14,9 +14,10 @@ import com.fr.design.extra.exe.GetPluginPrefixExecutor; import com.fr.design.extra.exe.PluginLoginExecutor; import com.fr.design.extra.exe.ReadUpdateOnlineExecutor; import com.fr.design.extra.exe.SearchOnlineExecutor; +import com.fr.design.gui.ifilechooser.FileChooserArgs; +import com.fr.design.gui.ifilechooser.FileChooserFactory; import com.fr.design.gui.ifilechooser.FileChooserProvider; import com.fr.design.gui.ifilechooser.FileSelectionMode; -import com.fr.design.gui.ifilechooser.JavaFxNativeFileChooser; import com.fr.design.i18n.Toolkit; import com.fr.design.locale.impl.BbsRegisterMark; import com.fr.design.locale.impl.BbsResetMark; @@ -39,11 +40,12 @@ import com.teamdev.jxbrowser.chromium.Browser; import com.teamdev.jxbrowser.chromium.JSArray; import com.teamdev.jxbrowser.chromium.JSFunction; import com.teamdev.jxbrowser.chromium.JSObject; -import javafx.stage.FileChooser; -import javax.swing.*; +import java.awt.Desktop; +import javax.swing.JFileChooser; +import javax.swing.SwingUtilities; +import javax.swing.SwingWorker; import javax.swing.filechooser.FileNameExtensionFilter; -import java.awt.*; import java.io.File; import java.net.URI; import java.util.ArrayList; @@ -312,10 +314,10 @@ public class UpmBridge { RunnableFuture future = new FutureTask<>(new Callable() { @Override public String call() { - FileChooserProvider fileChooserProvider = new JavaFxNativeFileChooser.Builder(). - fileSelectionMode(FileSelectionMode.FILE). - filter(des, filter). - build(); + FileChooserProvider fileChooserProvider = FileChooserFactory.createFileChooser( + FileChooserArgs.newBuilder(). + setFileSelectionMode(FileSelectionMode.FILE). + setFilter(des, filter).build()); int result = fileChooserProvider.showDialog(UpmFinder.getDialog()); if (result == JFileChooser.APPROVE_OPTION) { return fileChooserProvider.getSelectedFile().getAbsolutePath(); diff --git a/designer-base/src/main/java/com/fr/design/web/CustomIconPane.java b/designer-base/src/main/java/com/fr/design/web/CustomIconPane.java index 9e03dcc9dc..564b09d467 100644 --- a/designer-base/src/main/java/com/fr/design/web/CustomIconPane.java +++ b/designer-base/src/main/java/com/fr/design/web/CustomIconPane.java @@ -4,14 +4,14 @@ import com.fr.base.BaseUtils; import com.fr.base.GraphHelper; import com.fr.base.Icon; import com.fr.base.IconManager; -import com.fr.design.designer.IntervalConstants; import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.FineJOptionPane; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.icontainer.UIScrollPane; +import com.fr.design.gui.ifilechooser.FileChooserArgs; +import com.fr.design.gui.ifilechooser.FileChooserFactory; import com.fr.design.gui.ifilechooser.FileChooserProvider; -import com.fr.design.gui.ifilechooser.JavaFxNativeFileChooser; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.iscrollbar.UIScrollBar; import com.fr.design.gui.itextarea.DescriptionTextArea; @@ -30,23 +30,35 @@ import com.fr.stable.ListMap; import com.fr.stable.StringUtils; import com.fr.transaction.Configurations; import com.fr.transaction.WorkerFacade; -import javafx.stage.FileChooser; -import javax.swing.*; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Component; +import java.awt.Cursor; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Image; +import java.awt.Window; +import javax.swing.ButtonGroup; +import javax.swing.ImageIcon; +import javax.swing.JComponent; +import javax.swing.JFileChooser; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JToggleButton; +import javax.swing.ScrollPaneConstants; +import javax.swing.SwingUtilities; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; -import javax.swing.filechooser.FileNameExtensionFilter; import javax.swing.plaf.basic.BasicButtonUI; -import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.FocusEvent; import java.awt.event.FocusListener; import java.awt.geom.Rectangle2D; import java.awt.image.BufferedImage; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; /** * carl:自定义Icon编辑 @@ -414,7 +426,7 @@ public class CustomIconPane extends BasicPane { browseButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { - onBrowseButtonClicked(); + onBrowseButtonClicked(SwingUtilities.getWindowAncestor(EditIconDialog.this)); } }); @@ -449,12 +461,11 @@ public class CustomIconPane extends BasicPane { this.add(centerPane, BorderLayout.CENTER); } - private void onBrowseButtonClicked() { + private void onBrowseButtonClicked(Window parent) { // carl:不知道是否只要png格式,反正导出时全部都转成png了 - FileChooserProvider fileChooserProvider = new JavaFxNativeFileChooser.Builder(). - filter("Icon Image File", "*.jpg", "*.jpeg", "*.png", "*.gif"). - build(); - if (JFileChooser.APPROVE_OPTION == fileChooserProvider.showDialog(DesignerContext.getDesignerFrame())) { + FileChooserProvider fileChooserProvider = FileChooserFactory.createFileChooser(FileChooserArgs.newBuilder(). + setFilter("Icon Image File", "*.jpg", "*.jpeg", "*.png", "*.gif").build()); + if (JFileChooser.APPROVE_OPTION == fileChooserProvider.showDialog(parent)) { String path = fileChooserProvider.getSelectedFile().getAbsolutePath(); // 图片存储有最大值48*48限制,没有超过最大值时,按原图大小存储,超过最大值后,压缩至最大值存储 Image image = BaseUtils.readImage(path); diff --git a/designer-base/src/main/java/com/fr/design/worker/save/CallbackSaveWorker.java b/designer-base/src/main/java/com/fr/design/worker/save/CallbackSaveWorker.java index f8a0f5d4fa..ed2597f1d7 100644 --- a/designer-base/src/main/java/com/fr/design/worker/save/CallbackSaveWorker.java +++ b/designer-base/src/main/java/com/fr/design/worker/save/CallbackSaveWorker.java @@ -63,6 +63,15 @@ public class CallbackSaveWorker extends SaveWorker { } } + public void addSuccessCallbackBeforeLast(Runnable successRunnable) { + if (successRunnableList == null) { + successRunnableList = new LinkedList<>(); + } + if (successRunnable != null) { + successRunnableList.add(successRunnableList.size() - 1, successRunnable); + } + } + public void addFailCallback(Runnable failRunnable) { if (failRunnableList == null) { failRunnableList = new LinkedList<>(); diff --git a/designer-base/src/main/java/com/fr/design/worker/save/SaveFailureHandler.java b/designer-base/src/main/java/com/fr/design/worker/save/SaveFailureHandler.java index 4cf2af431a..5d7beb36ae 100644 --- a/designer-base/src/main/java/com/fr/design/worker/save/SaveFailureHandler.java +++ b/designer-base/src/main/java/com/fr/design/worker/save/SaveFailureHandler.java @@ -6,6 +6,7 @@ import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.JTemplate; +import com.fr.design.ui.util.UIUtil; import com.fr.design.utils.TemplateUtils; import com.fr.file.FileNodeFILE; import com.fr.file.filetree.FileNode; @@ -31,11 +32,19 @@ public class SaveFailureHandler implements ThrowableHandler { @Override public boolean process(Throwable e) { - for (Handler handler : Handler.values()) { - if (handler.process(e)) { - break; + UIUtil.invokeLaterIfNeeded(new Runnable() { + @Override + public void run() { + for (Handler handler : Handler.values()) { + try { + if (handler.process(e)) { + break; + } + } catch (Exception ignored) { + } + } } - } + }); return true; } diff --git a/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java b/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java index 56f90e804e..31bdaa979b 100644 --- a/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java +++ b/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java @@ -9,9 +9,10 @@ import com.fr.design.fun.DesignerEnvProcessor; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icontainer.UIScrollPane; +import com.fr.design.gui.ifilechooser.FileChooserArgs; +import com.fr.design.gui.ifilechooser.FileChooserFactory; import com.fr.design.gui.ifilechooser.FileChooserProvider; import com.fr.design.gui.ifilechooser.FileSelectionMode; -import com.fr.design.gui.ifilechooser.JavaFxNativeFileChooser; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ipasswordfield.UIPassWordField; import com.fr.design.gui.ipasswordfield.UIPasswordFieldWithFixedLength; @@ -564,7 +565,8 @@ public class RemoteEnvPane extends BasicBeanPane { fileChooserButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent evt) { - FileChooserProvider fileChooserProvider = new JavaFxNativeFileChooser.Builder().fileSelectionMode(FileSelectionMode.FILE).build(); + FileChooserProvider fileChooserProvider = FileChooserFactory.createFileChooser(FileChooserArgs.newBuilder(). + setFileSelectionMode(FileSelectionMode.FILE).build()); int saveValue = fileChooserProvider.showDialog(SwingUtilities.getWindowAncestor(RemoteEnvPane.this)); if (saveValue == JFileChooser.APPROVE_OPTION) { File selectedFile = fileChooserProvider.getSelectedFile(); diff --git a/designer-base/src/main/resources/com/fr/design/i18n/dimension_en.properties b/designer-base/src/main/resources/com/fr/design/i18n/dimension_en.properties index 786fe2ad0c..aa4a83f3e4 100644 --- a/designer-base/src/main/resources/com/fr/design/i18n/dimension_en.properties +++ b/designer-base/src/main/resources/com/fr/design/i18n/dimension_en.properties @@ -12,4 +12,6 @@ com.fr.design.web.pane.text.field=450*20 com.fr.design.actions.server.dialog=800*630 com.fr.design.report.fit.templatePane.dialog=800*400 com.fr.design.report.fit.firstColumn=120*20 -com.fr.design.report.fit.column=160*20 \ No newline at end of file +com.fr.design.report.fit.column=160*20 +com.fr.design.lock.LockInfoDialog=500*180 +com.fr.design.mainframe.ForbiddenPane.refreshButton=75*24 \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/i18n/dimension_ja_JP.properties b/designer-base/src/main/resources/com/fr/design/i18n/dimension_ja_JP.properties index 0956fa79d7..96558262fd 100644 --- a/designer-base/src/main/resources/com/fr/design/i18n/dimension_ja_JP.properties +++ b/designer-base/src/main/resources/com/fr/design/i18n/dimension_ja_JP.properties @@ -11,4 +11,6 @@ com.fr.design.web.pane.text.field=400*20 com.fr.design.actions.server.dialog=700*630 com.fr.design.report.fit.templatePane.dialog=600*400 com.fr.design.report.fit.firstColumn=170*20 -com.fr.design.report.fit.column=100*20 \ No newline at end of file +com.fr.design.report.fit.column=100*20 +com.fr.design.lock.LockInfoDialog=500*180 +com.fr.design.mainframe.ForbiddenPane.refreshButton=68*24 \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/i18n/dimension_ko_KR.properties b/designer-base/src/main/resources/com/fr/design/i18n/dimension_ko_KR.properties index 17031793ff..05e20c7aa8 100644 --- a/designer-base/src/main/resources/com/fr/design/i18n/dimension_ko_KR.properties +++ b/designer-base/src/main/resources/com/fr/design/i18n/dimension_ko_KR.properties @@ -11,4 +11,6 @@ com.fr.design.web.pane.text.field=450*20 com.fr.design.actions.server.dialog=700*630 com.fr.design.report.fit.templatePane.dialog=600*400 com.fr.design.report.fit.firstColumn=130*20 -com.fr.design.report.fit.column=100*20 \ No newline at end of file +com.fr.design.report.fit.column=100*20 +com.fr.design.lock.LockInfoDialog=500*180 +com.fr.design.mainframe.ForbiddenPane.refreshButton=80*24 \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/i18n/dimension_zh.properties b/designer-base/src/main/resources/com/fr/design/i18n/dimension_zh.properties index 931b79b44f..a4b2993e60 100644 --- a/designer-base/src/main/resources/com/fr/design/i18n/dimension_zh.properties +++ b/designer-base/src/main/resources/com/fr/design/i18n/dimension_zh.properties @@ -12,4 +12,6 @@ com.fr.design.web.pane.text.field=450*20 com.fr.design.actions.server.dialog=700*630 com.fr.design.report.fit.templatePane.dialog=600*400 com.fr.design.report.fit.firstColumn=80*20 -com.fr.design.report.fit.column=100*20 \ No newline at end of file +com.fr.design.report.fit.column=100*20 +com.fr.design.lock.LockInfoDialog=400*160 +com.fr.design.mainframe.ForbiddenPane.refreshButton=68*24 \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/i18n/dimension_zh_TW.properties b/designer-base/src/main/resources/com/fr/design/i18n/dimension_zh_TW.properties index 8ea7fd7c26..5813cd96cc 100644 --- a/designer-base/src/main/resources/com/fr/design/i18n/dimension_zh_TW.properties +++ b/designer-base/src/main/resources/com/fr/design/i18n/dimension_zh_TW.properties @@ -11,4 +11,6 @@ com.fr.design.web.pane.text.field=450*20 com.fr.design.actions.server.dialog=700*630 com.fr.design.report.fit.templatePane.dialog=600*400 com.fr.design.report.fit.firstColumn=80*20 -com.fr.design.report.fit.column=100*20 \ No newline at end of file +com.fr.design.report.fit.column=100*20 +com.fr.design.lock.LockInfoDialog=400*160 +com.fr.design.mainframe.ForbiddenPane.refreshButton=68*24 \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/transparent_background.png b/designer-base/src/main/resources/com/fr/design/images/transparent_background.png index 61557d0a80..3db1fd14f2 100644 Binary files a/designer-base/src/main/resources/com/fr/design/images/transparent_background.png and b/designer-base/src/main/resources/com/fr/design/images/transparent_background.png differ diff --git a/designer-chart/src/main/java/com/fr/design/chart/series/PlotSeries/MapCustomPane.java b/designer-chart/src/main/java/com/fr/design/chart/series/PlotSeries/MapCustomPane.java index 133e2fef74..a5351c74bf 100644 --- a/designer-chart/src/main/java/com/fr/design/chart/series/PlotSeries/MapCustomPane.java +++ b/designer-chart/src/main/java/com/fr/design/chart/series/PlotSeries/MapCustomPane.java @@ -9,8 +9,9 @@ import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.tabledata.wrapper.TableDataWrapper; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.icombobox.FilterComboBox; +import com.fr.design.gui.ifilechooser.FileChooserArgs; +import com.fr.design.gui.ifilechooser.FileChooserFactory; import com.fr.design.gui.ifilechooser.FileChooserProvider; -import com.fr.design.gui.ifilechooser.JavaFxNativeFileChooser; import com.fr.design.gui.ilable.BoldFontTextLabel; import com.fr.design.gui.ilable.UILabel; import com.fr.design.mainframe.DesignerContext; @@ -19,8 +20,6 @@ import com.fr.general.ComparatorUtils; import com.fr.general.GeneralUtils; import com.fr.general.data.DataModel; import com.fr.log.FineLoggerFactory; -import com.fr.stable.StringUtils; -import org.apache.batik.swing.svg.SVGFileFilter; import javax.swing.JFileChooser; import javax.swing.JPanel; @@ -110,10 +109,12 @@ public class MapCustomPane extends BasicBeanPane implements AbstrctMapAt private ActionListener selectPictureActionListener = new ActionListener() { + @Override public void actionPerformed(ActionEvent evt) { - FileChooserProvider fileChooserProvider = new JavaFxNativeFileChooser.Builder(). - filter(".svg, .svgz", "*.svg", "*.svgz"). - currentDirectory(lastSelectPath).build(); + FileChooserProvider fileChooserProvider = FileChooserFactory.createFileChooser( + FileChooserArgs.newBuilder(). + setFilter(".svg, .svgz", "*.svg", "*.svgz"). + setSelectedPath(lastSelectPath).build()); int returnVal = fileChooserProvider.showDialog(DesignerContext.getDesignerFrame()); if (returnVal != JFileChooser.CANCEL_OPTION) { File selectedFile = fileChooserProvider.getSelectedFile(); diff --git a/designer-form/src/main/java/com/fr/design/fit/NewJForm.java b/designer-form/src/main/java/com/fr/design/fit/NewJForm.java index 9df0806de3..0a12a74257 100644 --- a/designer-form/src/main/java/com/fr/design/fit/NewJForm.java +++ b/designer-form/src/main/java/com/fr/design/fit/NewJForm.java @@ -51,9 +51,9 @@ public class NewJForm extends JForm { public NewJForm(Form form) { super(form); - init(); //新建的模板都要加上新表单标志attr form.addAttrMark(NewFormMarkAttr.createNewFormAttr()); + init(); } public NewJForm(Form form, FILE file, Parameter[] parameters) { diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/action/InstallComponentAction.java b/designer-form/src/main/java/com/fr/design/mainframe/share/action/InstallComponentAction.java index 03e8ab2c07..d0b6d354a8 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/action/InstallComponentAction.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/action/InstallComponentAction.java @@ -4,10 +4,11 @@ import com.fr.design.actions.UpdateAction; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.FineJOptionPane; +import com.fr.design.gui.ifilechooser.ExtensionFilter; +import com.fr.design.gui.ifilechooser.FileChooserArgs; +import com.fr.design.gui.ifilechooser.FileChooserFactory; import com.fr.design.gui.ifilechooser.FileChooserProvider; import com.fr.design.gui.ifilechooser.FileSelectionMode; -import com.fr.design.gui.ifilechooser.JavaFxNativeFileChooser; -import com.fr.design.gui.ilable.UILabel; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.share.ui.base.FailureMessagePane; @@ -15,17 +16,13 @@ import com.fr.design.mainframe.share.ui.local.LocalWidgetRepoPane; import com.fr.design.mainframe.share.util.InstallUtils; import com.fr.design.mainframe.share.util.ShareComponentUtils; import com.fr.design.mainframe.share.util.ShareUIUtils; -import com.fr.design.os.impl.SupportOSImpl; import com.fr.form.share.record.ShareWidgetInfoManager; import com.fr.form.share.utils.ReuxUtils; import com.fr.log.FineLoggerFactory; -import com.sun.javafx.tk.FileChooserType; -import javafx.stage.FileChooser; import javax.swing.Action; import javax.swing.JFileChooser; import javax.swing.SwingWorker; -import javax.swing.filechooser.FileNameExtensionFilter; import java.awt.event.ActionEvent; import java.io.File; import java.util.ArrayList; @@ -46,15 +43,16 @@ public class InstallComponentAction extends UpdateAction { @Override public void actionPerformed(ActionEvent e) { - FileChooserProvider fileChooserProvider = - new JavaFxNativeFileChooser.Builder(). - fileSelectionMode(FileSelectionMode.MULTIPLE_FILE). - title(Toolkit.i18nText("Fine-Design_Basic_Select")). - filters(new FileChooser.ExtensionFilter[]{ - new FileChooser.ExtensionFilter("reu", "*.reu"), - new FileChooser.ExtensionFilter("reus", "*.reus"), - new FileChooser.ExtensionFilter("zip", "*.zip")}). - build(); + FileChooserProvider fileChooserProvider = FileChooserFactory.createFileChooser( + FileChooserArgs.newBuilder(). + setFileSelectionMode(FileSelectionMode.MULTIPLE_FILE). + setMultiSelectionEnabled(true). + setTipText(Toolkit.i18nText("Fine-Design_Basic_Select")). + setFilters(new ExtensionFilter[] { + new ExtensionFilter("reu", "*.reu"), + new ExtensionFilter("reus", "*.reus"), + new ExtensionFilter("zip", "*.zip"), + }).build()); int returnValue = fileChooserProvider.showDialog(null); installComponent(returnValue, fileChooserProvider.getSelectedFiles()); } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/LocalWidgetUpdater.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/LocalWidgetUpdater.java index 68a3123f78..b7d9e7f503 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/LocalWidgetUpdater.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/LocalWidgetUpdater.java @@ -13,6 +13,7 @@ import com.fr.form.share.DefaultSharableWidget; import com.fr.form.share.Group; import com.fr.form.share.GroupManege; import com.fr.form.share.SharableWidgetProvider; +import com.fr.form.share.bean.OnlineShareWidget; import com.fr.form.share.group.DefaultShareGroupManager; import com.fr.log.FineLoggerFactory; import com.fr.stable.StableUtils; @@ -54,7 +55,7 @@ public class LocalWidgetUpdater implements Process { return 0 <= processValue && processValue <= 1; } - public void updateWidget(String remoteLatestWidgetId, UpdateListener updateListener) { + public void updateWidget(OnlineShareWidget remoteLatestWidget, UpdateListener updateListener) { if (OnlineWidgetRepoPane.getInstance().isShowPackagePanel()) { ComponentCollector.getInstance().collectDownloadPktNum(); } @@ -77,7 +78,7 @@ public class LocalWidgetUpdater implements Process { } String filePath; try { - filePath = DownloadUtils.download(remoteLatestWidgetId, widget.getName() + "." + widget.getId(), LocalWidgetUpdater.this); + filePath = DownloadUtils.download(remoteLatestWidget.getId(), remoteLatestWidget.getFileLoca(), LocalWidgetUpdater.this); } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); return false; diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/local/LocalWidgetRepoPane.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/local/LocalWidgetRepoPane.java index 169b4b5e79..f344d59b06 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/local/LocalWidgetRepoPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/local/LocalWidgetRepoPane.java @@ -438,7 +438,7 @@ public class LocalWidgetRepoPane extends BasicPane { LocalWidgetRepoUpdater updater = LocalWidgetRepoUpdater.getInstance(); for (LocalWidgetBlock block: blockList) { OnlineShareWidget remoteLatestWidget = updater.findLatestRemoteWidget(block.getWidget()); - block.getUpdater().updateWidget(remoteLatestWidget.getId(), new LocalWidgetUpdater.UpdateListener() { + block.getUpdater().updateWidget(remoteLatestWidget, new LocalWidgetUpdater.UpdateListener() { @Override public void onUpdated(boolean success, String group, String id) { updateGuard -= 1; diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/OnlineWidgetTabPane.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/OnlineWidgetTabPane.java index b48b74e67d..52ea26bc26 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/OnlineWidgetTabPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/OnlineWidgetTabPane.java @@ -24,6 +24,7 @@ public class OnlineWidgetTabPane extends JPanel { private static final String COMPONENT = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Share"); private static final String COMPONENT_PACKAGE = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Share_Package"); private static final String COMPONENT_EMBED = "COMPONENT_EMBED"; + private UITabGroup headGroup; private CardLayout cardLayout; private JPanel centerPane; private boolean packagePaneCreated = false; @@ -43,7 +44,7 @@ public class OnlineWidgetTabPane extends JPanel { this.centerPane.add(new OnlineWidgetShowPane(sharableWidgets), COMPONENT); this.centerPane.add( embedFilterShowPane = new OnlineEmbedFilterShowPane(new OnlineWidgetShowPane(sharableWidgets, OnlineWidgetSortType.SALES)), COMPONENT_EMBED); //延迟组件包面板的初始化,防止组件面板里组件的缩略图和组件包面板里组件的缩略图一起加载 - UITabGroup headGroup = new UITabGroup(new String[]{COMPONENT, COMPONENT_PACKAGE}) { + this.headGroup = new UITabGroup(new String[]{COMPONENT, COMPONENT_PACKAGE}) { public void tabChanged(int newSelectedIndex) { for (TabChangeListener changeListener : tabChangeListeners) { changeListener.tabChange(newSelectedIndex); @@ -63,7 +64,7 @@ public class OnlineWidgetTabPane extends JPanel { } }; - headGroup.setSelectedIndex(0); + this.headGroup.setSelectedIndex(0); this.centerPane.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); jPanel.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 10)); @@ -84,6 +85,7 @@ public class OnlineWidgetTabPane extends JPanel { } } public void refreshPane() { + this.headGroup.setSelectedIndex(0); this.cardLayout.show(centerPane, ComponentShareUtil.needShowEmbedFilterPane() ? COMPONENT_EMBED : COMPONENT); } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/util/DownloadUtils.java b/designer-form/src/main/java/com/fr/design/mainframe/share/util/DownloadUtils.java index 020c03bff1..a814dfa0aa 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/util/DownloadUtils.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/util/DownloadUtils.java @@ -37,6 +37,9 @@ import java.nio.charset.StandardCharsets; import java.security.KeyFactory; import java.security.interfaces.RSAPublicKey; import java.security.spec.X509EncodedKeySpec; +import java.util.HashMap; +import java.util.Map; +import java.util.Set; /** * created by Harrison on 2020/05/27 @@ -68,9 +71,9 @@ public class DownloadUtils { @NotNull public static String download(String id, String fileName, com.fr.design.extra.Process process) throws Exception { - CloseableHttpResponse fileRes = getHttpResponse(getReusesUrl(), id); + CloseableHttpResponse fileRes = postDownloadHttpResponse(getReusesUrl(), id); if (fileRes.getStatusLine().getStatusCode() == HttpStatus.SC_MOVED_TEMPORARILY) { - fileRes = getHttpResponse(fileRes.getHeaders("Location")[0].getValue()); + fileRes = getDownloadHttpResponse(fileRes.getHeaders("Location")[0].getValue()); } if (fileRes.getStatusLine().getStatusCode() == HttpStatus.SC_OK) { String realPath = StableUtils.pathJoin(ProductConstants.getEnvHome(), ShareComponentConstants.PLUGIN_CACHE, ShareComponentConstants.DOWNLOAD_SHARE); @@ -106,9 +109,11 @@ public class DownloadUtils { public static String downloadPackage(String id, String fileName, CancelCheck cancelCheck) throws Exception { - CloseableHttpResponse fileRes = getHttpResponse(getPackageReusesUrl(), id); + Map params = new HashMap<>(); + params.put("designerVersion", ProductConstants.RELEASE_VERSION); + CloseableHttpResponse fileRes = postDownloadHttpResponse(getPackageReusesUrl(), id, params); if (fileRes.getStatusLine().getStatusCode() == HttpStatus.SC_MOVED_TEMPORARILY) { - fileRes = getHttpResponse(fileRes.getHeaders("Location")[0].getValue()); + fileRes = getDownloadHttpResponse(fileRes.getHeaders("Location")[0].getValue()); } String realPath = StableUtils.pathJoin(ProductConstants.getEnvHome(), ShareComponentConstants.PLUGIN_CACHE, ShareComponentConstants.DOWNLOAD_PACKAGE_SHARE); String filePath; @@ -145,9 +150,9 @@ public class DownloadUtils { public static FormTheme downloadThemeFile(String themePath) { try { - CloseableHttpResponse fileRes = getHttpResponse(themePath); + CloseableHttpResponse fileRes = getDownloadHttpResponse(themePath); if (fileRes.getStatusLine().getStatusCode() == HttpStatus.SC_MOVED_TEMPORARILY) { - fileRes = getHttpResponse(fileRes.getHeaders("Location")[0].getValue()); + fileRes = getDownloadHttpResponse(fileRes.getHeaders("Location")[0].getValue()); } if (fileRes.getStatusLine().getStatusCode() == HttpStatus.SC_OK) { HttpEntity entity = fileRes.getEntity(); @@ -177,21 +182,33 @@ public class DownloadUtils { return null; } - private static CloseableHttpResponse getHttpResponse(String url, String id) throws Exception { + private static CloseableHttpResponse postDownloadHttpResponse(String url, String id) throws Exception { + return postDownloadHttpResponse(url, id, new HashMap<>()); + } + + private static CloseableHttpResponse postDownloadHttpResponse(String url, String id, Map params) throws Exception { //先登录一下。不然可能失败 CloseableHttpClient client = createClient(); FineLoggerFactory.getLogger().info("login fr-market"); FineLoggerFactory.getLogger().info("start download widget {}", id); - HttpUriRequest file = RequestBuilder.post() + RequestBuilder builder = RequestBuilder.post() .setHeader("User-Agent", "Mozilla/5.0") - .setUri(url).addParameter("id", encrypt(id)).addParameter("userId", - String.valueOf(DesignerEnvManager.getEnvManager().getDesignerLoginUid())) - .build(); - return client.execute(file); + .setUri(url) + .addParameter("id", encrypt(id)) + .addParameter("userId", String.valueOf(DesignerEnvManager.getEnvManager().getDesignerLoginUid())); + + if (params != null) { + Set keys = params.keySet(); + for (String key: keys) { + builder.addParameter(key, params.get(key)); + } + } + + return client.execute(builder.build()); } - private static CloseableHttpResponse getHttpResponse(String url) throws Exception { + private static CloseableHttpResponse getDownloadHttpResponse(String url) throws Exception { //先登录一下。不然可能失败 CloseableHttpClient client = createClient(); HttpUriRequest file = RequestBuilder.get() diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/util/OnlineShopUtils.java b/designer-form/src/main/java/com/fr/design/mainframe/share/util/OnlineShopUtils.java index c42f06946b..7341d7cbb6 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/util/OnlineShopUtils.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/util/OnlineShopUtils.java @@ -14,6 +14,7 @@ import com.fr.general.http.HttpToolbox; import com.fr.json.JSONArray; import com.fr.json.JSONObject; import com.fr.log.FineLoggerFactory; +import com.fr.stable.ProductConstants; import com.fr.stable.StableUtils; import com.fr.stable.StringUtils; @@ -251,7 +252,7 @@ public class OnlineShopUtils { } public static OnlineShareWidget[] getPackageWidgets(OnlineShareWidget widgetPackage) { - String plistUrl = getPackageChildrenPath() + widgetPackage.getId(); + String plistUrl = getPackageChildrenPath() + widgetPackage.getId() + "?designerVersion="+ ProductConstants.RELEASE_VERSION; OnlineShareWidget[] widgets = getOnlineShareWidgets(plistUrl); for (OnlineShareWidget widget : widgets) { widget.setParentPackage(widgetPackage); @@ -287,7 +288,7 @@ public class OnlineShopUtils { onlineShareWidgets.add(widget); } } - return onlineShareWidgets.toArray(new OnlineShareWidget[onlineShareWidgets.size()]); + return onlineShareWidgets.toArray(new OnlineShareWidget[0]); } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } diff --git a/designer-form/src/main/java/com/fr/design/preview/DeveloperPreview.java b/designer-form/src/main/java/com/fr/design/preview/DeveloperPreview.java index 782538f63a..69e514b408 100644 --- a/designer-form/src/main/java/com/fr/design/preview/DeveloperPreview.java +++ b/designer-form/src/main/java/com/fr/design/preview/DeveloperPreview.java @@ -6,10 +6,13 @@ import com.fr.design.fun.impl.AbstractPreviewProvider; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.JForm; import com.fr.design.mainframe.JTemplate; +import com.fr.design.worker.WorkerManager; +import com.fr.design.worker.save.CallbackSaveWorker; import com.fr.general.web.ParameterConstants; import java.util.HashMap; import java.util.Map; +import javax.swing.SwingWorker; /** * Created by kerry on 2020-04-23 @@ -44,6 +47,22 @@ public class DeveloperPreview extends AbstractPreviewProvider { @Override public void onClick(JTemplate jt) { super.onClick(jt); + SwingWorker worker = WorkerManager.getInstance().getWorker(jt.getRuntimeId()); + if (worker instanceof CallbackSaveWorker) { + CallbackSaveWorker callbackSaveWorker = (CallbackSaveWorker) worker; + callbackSaveWorker.addSuccessCallbackBeforeLast(new Runnable() { + @Override + public void run() { + onPreview(jt); + } + }); + } else if (jt.getEditingFILE().isEnvFile()) { + // 已经保存在当前工作目录了 + onPreview(jt); + } + } + + private void onPreview(JTemplate jt) { MutilTempalteTabPane.getInstance().closeCurrentTpl(); jt.generateForBiddenTemplate(); } diff --git a/designer-realize/src/main/java/com/fr/design/actions/cell/BorderAction.java b/designer-realize/src/main/java/com/fr/design/actions/cell/BorderAction.java index 844e4f70bf..8752d54de5 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/cell/BorderAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/cell/BorderAction.java @@ -110,13 +110,17 @@ public class BorderAction extends ElementCaseAction implements ChangeListener { public boolean update(ElementCasePane elementCasePane) { - resetSelectedElementsStyleToCustom(elementCasePane); - + boolean success; if (oldCellBorderStyle.isNoneBorderStyle()) { //无边框格式 - return BorderUtils.updateCellBorderStyle(elementCasePane, oldCellBorderStyle); + success = BorderUtils.updateCellBorderStyle(elementCasePane, oldCellBorderStyle); + } else { + success = BorderUtils.update(elementCasePane, oldCellBorderStyle); + } + if (success) { + resetSelectedElementsStyleToCustom(elementCasePane); } - return BorderUtils.update(elementCasePane, oldCellBorderStyle); + return success; } @Override diff --git a/designer-realize/src/main/java/com/fr/design/actions/report/ReportEngineAttrAction.java b/designer-realize/src/main/java/com/fr/design/actions/report/ReportEngineAttrAction.java index d80622b56f..8bac8dac76 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/report/ReportEngineAttrAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/report/ReportEngineAttrAction.java @@ -74,12 +74,8 @@ public class ReportEngineAttrAction extends ReportComponentAction(FOLLOWING_THEME_STRING_ARRAYS); followingThemeButtonGroup.setAutoFireStateChanged(false); customStylePane = new CustomFloatStyleSettingPane(); diff --git a/designer-realize/src/main/java/com/fr/design/webattr/PageToolBarPane.java b/designer-realize/src/main/java/com/fr/design/webattr/PageToolBarPane.java index 48fb0c8ddb..783bc0e6a3 100644 --- a/designer-realize/src/main/java/com/fr/design/webattr/PageToolBarPane.java +++ b/designer-realize/src/main/java/com/fr/design/webattr/PageToolBarPane.java @@ -60,7 +60,7 @@ public class PageToolBarPane extends AbstractEditToolBarPane { private UICheckBox isPageFixedRowBox; private UITextField pageFixedRowCountTextField; private static final Color TIPS_FONT_COLOR = new Color(0x8f8f92); - private static final Pattern ROW_COUNT = Pattern.compile("^[1-9][\\d]{0,2}$"); + private static final Pattern ROW_COUNT = Pattern.compile("^[1-9][\\d]*$|^0"); //固定行数分页,每页最多500行,最少1行数据 private static final int MAX_ROW_COUNT = 500; @@ -275,18 +275,21 @@ public class PageToolBarPane extends AbstractEditToolBarPane { @Override public void keyReleased(KeyEvent e) { String rowCount = pageFixedRowCountTextField.getText(); - if (!isRowCountValid(rowCount)) { - pageFixedRowCountTextField.setText(StringUtils.EMPTY); - } + pageFixedRowCountTextField.setText(convert2ValidRowCount(rowCount)); } }; - private boolean isRowCountValid(String rowCount) { + private String convert2ValidRowCount(String rowCount) { Matcher matcher = ROW_COUNT.matcher(rowCount); if (matcher.find()) { int count = Integer.parseInt(matcher.group()); - return count >= MIN_ROW_COUNT && count <= MAX_ROW_COUNT; + if (count > MAX_ROW_COUNT) { + count = MAX_ROW_COUNT; + } else if (count < MIN_ROW_COUNT) { + count = MIN_ROW_COUNT; + } + return String.valueOf(count); } - return false; + return StringUtils.EMPTY; } } diff --git a/designer-realize/src/main/java/com/fr/design/webattr/PageWebSettingPane.java b/designer-realize/src/main/java/com/fr/design/webattr/PageWebSettingPane.java index 98890f6d8c..1a3d323e9f 100644 --- a/designer-realize/src/main/java/com/fr/design/webattr/PageWebSettingPane.java +++ b/designer-realize/src/main/java/com/fr/design/webattr/PageWebSettingPane.java @@ -41,7 +41,7 @@ public class PageWebSettingPane extends WebSettingPane { private UICheckBox isPageFixedRowBox; private UITextField pageFixedRowCountTextField; private static final Color TIPS_FONT_COLOR = new Color(0x8f8f92); - private static final Pattern ROW_COUNT = Pattern.compile("^[1-9][\\d]{0,2}$"); + private static final Pattern ROW_COUNT = Pattern.compile("^[1-9][\\d]*$|^0"); private static final String DEFAULT_ROW_COUNT = "30"; //固定行数分页,每页最多500行,最少1行数据 @@ -82,9 +82,7 @@ public class PageWebSettingPane extends WebSettingPane { @Override public void keyReleased(KeyEvent e) { String rowCount = pageFixedRowCountTextField.getText(); - if (!isRowCountValid(rowCount)) { - pageFixedRowCountTextField.setText(StringUtils.EMPTY); - } + pageFixedRowCountTextField.setText(convert2ValidRowCount(rowCount)); } }); pageFixedRowCountTextField.addInputMethodListener(new InputMethodListener() { @@ -207,12 +205,17 @@ public class PageWebSettingPane extends WebSettingPane { reportWebAttr.setWebPage(webContent); } - private boolean isRowCountValid(String rowCount) { + private String convert2ValidRowCount(String rowCount) { Matcher matcher = ROW_COUNT.matcher(rowCount); if (matcher.find()) { int count = Integer.parseInt(matcher.group()); - return count >= MIN_ROW_COUNT && count <= MAX_ROW_COUNT; + if (count > MAX_ROW_COUNT) { + count = MAX_ROW_COUNT; + } else if (count < MIN_ROW_COUNT) { + count = MIN_ROW_COUNT; + } + return String.valueOf(count); } - return false; + return StringUtils.EMPTY; } } diff --git a/designer-realize/src/main/java/com/fr/design/write/submit/SmartInsertDBManipulationPane.java b/designer-realize/src/main/java/com/fr/design/write/submit/SmartInsertDBManipulationPane.java index 3818f1ac80..193fd4de9a 100644 --- a/designer-realize/src/main/java/com/fr/design/write/submit/SmartInsertDBManipulationPane.java +++ b/designer-realize/src/main/java/com/fr/design/write/submit/SmartInsertDBManipulationPane.java @@ -291,6 +291,10 @@ public class SmartInsertDBManipulationPane extends DBManipulationPane { @Override public void checkValid() throws Exception { KeyColumnTableModel model = (KeyColumnTableModel) keyColumnValuesTable.getModel(); + checkModelValid(model); + } + + private void checkModelValid(KeyColumnTableModel model) throws Exception { int cnt = model.getRowCount(); int groupLength = -1; for (int i = 0; i < cnt; i++) { @@ -374,7 +378,8 @@ public class SmartInsertDBManipulationPane extends DBManipulationPane { */ @Override public void checkValid() throws Exception { - SmartInsertDBManipulationPane.this.checkValid(); + KeyColumnTableModel model = (KeyColumnTableModel) table.getModel(); + SmartInsertDBManipulationPane.this.checkModelValid(model); } private SelectionListener listener = new SelectionListener() { diff --git a/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java b/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java index 56b5785784..eea3360bae 100644 --- a/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java +++ b/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java @@ -10,6 +10,7 @@ import com.fr.base.theme.migrator.FormThemeConfigMigrator; import com.fr.base.theme.migrator.ReportThemeConfigMigrator; import com.fr.chart.chartattr.ChartCollection; import com.fr.config.MarketConfig; +import com.fr.config.ServerPreferenceConfig; import com.fr.decision.update.backup.RecoverManager; import com.fr.design.DesignerEnvManager; import com.fr.design.ExtraDesignClassManager; @@ -187,6 +188,9 @@ public class DesignerActivator extends Activator implements Prepare { //生成BasicChartQuickEditor对象,需要用到ChartDesignerActivator的注册信息(DesignModuleFactory.registerChartPropertyPaneClass(ChartPropertyPane.class);) //所以不能在registerCellEditor函数中进行注册 ActionFactory.registerCellEditor(ChartCollection.class, new BasicChartQuickEditor()); + if (DesignerEnvManager.getEnvManager().isUseOptimizedUPM4Adapter() && WorkContext.getCurrent().isLocal()) { + ServerPreferenceConfig.getInstance().setUseOptimizedUPM(DesignerEnvManager.getEnvManager().isUseOptimizedUPM4Adapter()); + } } private void loadLogAppender() {