diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionComboBoxPanel.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionComboBoxPanel.java index 3b5aebed9e..fe69024a82 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionComboBoxPanel.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionComboBoxPanel.java @@ -10,11 +10,10 @@ import com.fr.design.editlock.EditLockUtils; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UILockButton; import com.fr.file.ConnectionConfig; -import com.fr.general.ComparatorUtils; +import com.fr.report.LockItem; import com.fr.stable.StringUtils; import com.fr.workspace.WorkContext; import com.fr.workspace.server.connection.DBConnectAuth; -import com.fr.report.LockItem; import javax.swing.SwingUtilities; import java.awt.Dimension; @@ -96,6 +95,7 @@ public class ConnectionComboBoxPanel extends ItemEditableComboBoxPanel { continue; } Connection connection = mgr.getConnection(conName); + // nameList依赖items方法初始化,父类ItemEditableComboBoxPanel里异步执行item方法 filterConnection(connection, conName, nameList); } @@ -140,12 +140,10 @@ public class ConnectionComboBoxPanel extends ItemEditableComboBoxPanel { } else { String s = DesignerEnvManager.getEnvManager().getRecentSelectedConnection(); if (StringUtils.isNotBlank(s)) { - for (int i = 0; i < this.getConnectionSize(); i++) { - String t = this.getConnection(i); - if (ComparatorUtils.equals(s, t)) { - this.setSelectedItem(s); - break; - } + // 之前的写法有多线程问题,nameList异步尚未初始化完成的时候,这里可能无法匹配设置数据连接名称,导致DBTableDataPane打开后连接面板空白 + // 这里的需求无非是设置上一次使用的数据连接,做个简单检查这个连接是否存在即可,存在就设置 + if (ConnectionConfig.getInstance().getConnection(s) != null) { + this.setSelectedItem(s); } } // alex:如果这个ComboBox还是没有选中,那么选中第一个 diff --git a/designer-base/src/main/java/com/fr/design/gui/style/ReportBackgroundSpecialPane.java b/designer-base/src/main/java/com/fr/design/gui/style/ReportBackgroundSpecialPane.java index aeb2938a27..257e090c20 100644 --- a/designer-base/src/main/java/com/fr/design/gui/style/ReportBackgroundSpecialPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/style/ReportBackgroundSpecialPane.java @@ -29,7 +29,7 @@ public class ReportBackgroundSpecialPane extends BackgroundPane { protected BackgroundQuickPane[] supportKindsOfBackgroundUI() { NullBackgroundQuickPane nullBackgroundPane = new NullBackgroundQuickPane(); - ColorBackgroundQuickPane colorBackgroundPane = new ColorBackgroundQuickPane(); + ColorBackgroundQuickPane colorBackgroundPane = new ColorBackgroundQuickPane(true); colorBackgroundPane.registerChangeListener(new UIObserverListener() { @Override public void doChange() { diff --git a/designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/ColorBackgroundQuickPane.java b/designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/ColorBackgroundQuickPane.java index 9d9eb0058c..086a07da48 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/ColorBackgroundQuickPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/ColorBackgroundQuickPane.java @@ -16,10 +16,9 @@ public class ColorBackgroundQuickPane extends BackgroundQuickPane { private NewColorSelectBox colorSelectBox; - - public ColorBackgroundQuickPane() { + public ColorBackgroundQuickPane(boolean supportTransparent) { this.setLayout(FRGUIPaneFactory.createBorderLayout()); - colorSelectBox = new NewColorSelectBox(100) { + colorSelectBox = new NewColorSelectBox(100, supportTransparent) { @Override public boolean shouldResponseChangeListener() { // ColorBackgroundQuickPane注册监听器ChangeListenerImpl的逻辑不能丢,因为里面有修改字段backgroundChange的逻辑. @@ -33,6 +32,10 @@ public class ColorBackgroundQuickPane extends BackgroundQuickPane { this.add(colorSelectBox, BorderLayout.NORTH); } + public ColorBackgroundQuickPane() { + this(false); + } + public void populateBean(Background background) { ColorBackground colorBackgroud = (ColorBackground) background; populateColor(colorBackgroud.getColor()); diff --git a/designer-base/src/main/java/com/fr/design/startup/Install4jStartupNotificationProvider.java b/designer-base/src/main/java/com/fr/design/startup/Install4jStartupNotificationProvider.java index dbc7be2b72..5402032f94 100644 --- a/designer-base/src/main/java/com/fr/design/startup/Install4jStartupNotificationProvider.java +++ b/designer-base/src/main/java/com/fr/design/startup/Install4jStartupNotificationProvider.java @@ -1,6 +1,10 @@ package com.fr.design.startup; -import com.install4j.api.launcher.StartupNotification; +import com.fr.invoke.Reflect; + +import java.lang.reflect.InvocationHandler; +import java.lang.reflect.Method; +import java.lang.reflect.Proxy; /** * @author Starryi @@ -18,18 +22,30 @@ public class Install4jStartupNotificationProvider implements FineStartupNotifica @Override public void registerStartupListener(Listener listener) { - boolean supported = false; - try { - supported = Class.forName("com.install4j.api.launcher.StartupNotification") != null; - } catch (Throwable ignored) {} - - if (supported) { - StartupNotification.registerStartupListener(new StartupNotification.Listener() { - @Override - public void startupPerformed(String parameters) { - listener.startupPerformed(parameters); - } - }); + Class StartupNotificationListenerClass = Reflect.on("com.install4j.api.launcher.StartupNotification$Listener").type(); + if (StartupNotificationListenerClass == null) { + return; + } + + ListenerHandler mHandler = new ListenerHandler(listener); + Object listenerCallbackInstance = Proxy.newProxyInstance(this.getClass().getClassLoader(), new Class[] { StartupNotificationListenerClass }, mHandler); + Reflect.on("com.install4j.api.launcher.StartupNotification").call("registerStartupListener", listenerCallbackInstance); + } + + private static class ListenerHandler implements InvocationHandler { + private final Listener listener; + + public ListenerHandler(Listener listener) { + this.listener = listener; + } + + @Override + public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { + if (args[0] instanceof String) { + String parameters = (String) args[0]; + listener.startupPerformed(parameters); + } + return null; } } } diff --git a/designer-base/src/main/java/com/fr/design/style/color/ColorCell.java b/designer-base/src/main/java/com/fr/design/style/color/ColorCell.java index 4cc3e41cea..acc26ca5aa 100644 --- a/designer-base/src/main/java/com/fr/design/style/color/ColorCell.java +++ b/designer-base/src/main/java/com/fr/design/style/color/ColorCell.java @@ -100,11 +100,13 @@ public class ColorCell extends JComponent implements ColorSelectable { if (e == null || e.getID() == MouseEvent.MOUSE_RELEASED) { colorSelectable.setColor(this.getColor()); - colorSelectable.colorSetted(this); + // 先添加最近使用 if (this.getColor() != null) { int rgb = this.getColor().getRGB(); DesignerEnvManager.getEnvManager().getColorConfigManager().addToColorQueue(new Color(rgb)); } + // 这边会获取到最近使用颜色并更新 添加逻辑需要放到前面 否则不会及时更新 + colorSelectable.colorSetted(this); } if (e != null) { diff --git a/designer-base/src/main/java/com/fr/design/style/color/NewColorSelectBox.java b/designer-base/src/main/java/com/fr/design/style/color/NewColorSelectBox.java index 04d368e6bc..59ef1e6e43 100644 --- a/designer-base/src/main/java/com/fr/design/style/color/NewColorSelectBox.java +++ b/designer-base/src/main/java/com/fr/design/style/color/NewColorSelectBox.java @@ -20,13 +20,20 @@ public class NewColorSelectBox extends AbstractSelectBox implements UIObs private static final long serialVersionUID = 2782150678943960557L; private Color color; - private NewColorSelectPane colorPane = new NewColorSelectPane(false); + private NewColorSelectPane colorPane; private UIObserverListener uiObserverListener; private String newColorSelectBoxName = ""; private GlobalNameListener globalNameListener = null; + private boolean supportTransparent; public NewColorSelectBox(int preferredWidth) { - initBox(preferredWidth); + this(preferredWidth, false); + } + + public NewColorSelectBox(int preferredWidth, boolean supportTransparent) { + this.colorPane = new NewColorSelectPane(supportTransparent); + this.supportTransparent = supportTransparent; + initBox(preferredWidth); iniListener(); } @@ -58,7 +65,7 @@ public class NewColorSelectBox extends AbstractSelectBox implements UIObs */ public JPanel initWindowPane(double preferredWidth) { // 下拉的时候重新生成面板,以刷新最近使用颜色 - colorPane = new NewColorSelectPane(false); + colorPane = new NewColorSelectPane(this.supportTransparent); colorPane.setColor(this.getSelectObject()); colorPane.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XWFitLayout.java b/designer-form/src/main/java/com/fr/design/designer/creator/XWFitLayout.java index ea61700522..886089a0be 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XWFitLayout.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XWFitLayout.java @@ -764,6 +764,7 @@ public class XWFitLayout extends XLayoutContainer { creator.setBackupBound(creator.getBounds()); } } + LayoutUtils.layoutContainer(this); } private Rectangle recalculateWidgetBounds(Rectangle rec, int[] hors, int[] veris) { @@ -831,11 +832,7 @@ public class XWFitLayout extends XLayoutContainer { this.remove(oldCreator); this.add(newCreator); dealDirections(newCreator, false); - //对于新增的绝对布局的组件,需要更新下内部组件的大小 - if (newCreator.acceptType(XWAbsoluteLayout.class)){ - ((XWAbsoluteLayout) newCreator).updateBoundsWidget(); - newCreator.setBackupBound(newCreator.getBounds()); - } + this.updateBoundsWidget(); isRefreshing = false; LayoutUtils.layoutContainer(this); } diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XWParameterLayout.java b/designer-form/src/main/java/com/fr/design/designer/creator/XWParameterLayout.java index a41ec46f6f..aacdf6d04b 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XWParameterLayout.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XWParameterLayout.java @@ -270,4 +270,16 @@ public class XWParameterLayout extends XWAbsoluteLayout { public boolean isTopable() { return false; } + + /** + * 修改form布局的宽度时,需要同时修改表单参数界面的布局的宽度。 + * */ + @Override + public void doLayout() { + layout(); + if (data != null && data instanceof WParameterLayout) { + ((WParameterLayout) data).setDesignWidth(getWidth()); + } + } + } diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardTagLayout.java b/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardTagLayout.java index 850378af21..ec070ad867 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardTagLayout.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardTagLayout.java @@ -8,6 +8,7 @@ import com.fr.base.ScreenResolution; import com.fr.design.designer.beans.AdapterBus; import com.fr.design.designer.beans.LayoutAdapter; import com.fr.design.designer.beans.adapters.layout.FRWCardTagLayoutAdapter; +import com.fr.design.designer.beans.models.ModelUtil; import com.fr.design.designer.beans.models.SelectionModel; import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XCreatorUtils; @@ -136,6 +137,9 @@ public class XWCardTagLayout extends XWHorizontalBoxLayout { WTabFitLayout fitLayout = new WTabFitLayout(widgetName, tabFitIndex, currentCard); fitLayout.setTabNameIndex(getTabNameIndex()); XWTabFitLayout tabFitLayout = new XWTabFitLayout(fitLayout, new Dimension()); + + FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner(); + ModelUtil.renameWidgetName(formDesigner.getTarget(), tabFitLayout); WCardTagLayout layout = (WCardTagLayout) this.toData(); if(!ComparatorUtils.equals(layout.getTemplateStyle().getStyle(), DefaultTemplateStyle.DEFAULT_TEMPLATE_STYLE)){ diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRFitLayoutDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRFitLayoutDefinePane.java index 205ad01ffb..e53649ee1a 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRFitLayoutDefinePane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRFitLayoutDefinePane.java @@ -71,6 +71,7 @@ public class FRFitLayoutDefinePane extends AbstractFRLayoutDefinePane { protected JPanel createOtherSetPane() { colorBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Set_Background_Of_Current_Row") + ":"); colorBox.setSelected(true); - colorButton = new UIColorButton(BaseUtils.readIcon("/com/fr/design/images/gui/color/background.png")); + colorButton = new UINoThemeColorButton(BaseUtils.readIcon("/com/fr/design/images/gui/color/background.png")); colorBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { colorButton.setEnabled(colorBox.isSelected());