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 ca85a65171..9d84e25bae 100644 --- a/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java +++ b/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java @@ -19,6 +19,7 @@ import com.fr.design.i18n.Toolkit; import com.fr.design.locale.impl.ProductImproveMark; import com.fr.design.login.DesignerLoginType; import com.fr.design.login.config.DesignerLoginConfigManager; +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; @@ -415,6 +416,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { private void compatibilityPrevVersion(File prevEnvFile) { try { XMLTools.readFileXML(designerEnvManager, prevEnvFile); + clearOldVersionDesignerEnvProperties(); } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } @@ -424,6 +426,11 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { designerEnvManager.saveXMLFile(); } + private void clearOldVersionDesignerEnvProperties() { + SnapChatConfig snapChatConfig = designerEnvManager.getSnapChatConfig(); + snapChatConfig.resetRead(ComponentReuseNotifyUtil.COMPONENT_SNAP_CHAT_KEY); + } + public static void setEnvFile(File envFile) { DesignerEnvManager.envFile = envFile; } @@ -2332,4 +2339,8 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { DesignerExiter.getInstance().execute(); } } + + public SnapChatConfig getSnapChatConfig() { + return snapChatConfig; + } } diff --git a/designer-base/src/main/java/com/fr/design/extra/PluginOperateUtils.java b/designer-base/src/main/java/com/fr/design/extra/PluginOperateUtils.java index d7260f84ee..7dd2097dc7 100644 --- a/designer-base/src/main/java/com/fr/design/extra/PluginOperateUtils.java +++ b/designer-base/src/main/java/com/fr/design/extra/PluginOperateUtils.java @@ -25,6 +25,8 @@ import com.fr.plugin.manage.control.PluginTask; import com.fr.plugin.manage.control.PluginTaskCallback; import com.fr.plugin.manage.control.PluginTaskResult; import com.fr.plugin.view.PluginView; +import com.fr.plugin.xml.PluginElementName; +import com.fr.plugin.xml.PluginXmlElement; import com.fr.stable.StringUtils; import javax.swing.JOptionPane; @@ -91,15 +93,37 @@ public class PluginOperateUtils { public static void setPluginActive(String pluginInfo, JSCallback jsCallback) { - PluginMarker pluginMarker = PluginUtils.createPluginMarker(pluginInfo); - PluginContext plugin = PluginManager.getContext(pluginMarker); - boolean active = plugin.isActive(); - PluginTaskCallback modifyStatusCallback = new ModifyStatusCallback(active, jsCallback); - if (active) { - PluginManager.getController().forbid(pluginMarker, modifyStatusCallback); - } else { - PluginManager.getController().enable(pluginMarker, modifyStatusCallback); - } + SwingUtilities.invokeLater(new Runnable() { + + @Override + public void run() { + PluginMarker pluginMarker = PluginUtils.createPluginMarker(pluginInfo); + PluginContext plugin = PluginManager.getContext(pluginMarker); + boolean active = plugin.isActive(); + PluginTaskCallback modifyStatusCallback = new ModifyStatusCallback(active, jsCallback); + if (active) { + PluginXmlElement forbidReminder = plugin.getXml().getElement(PluginElementName.ForbidReminder); + if (forbidReminder != null && forbidReminder.getContent() != null) { + // 禁用前提示 + int rv = FineJOptionPane.showConfirmDialog( + null, + forbidReminder.getContent(), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), + JOptionPane.OK_CANCEL_OPTION, + JOptionPane.WARNING_MESSAGE + ); + if (rv == JOptionPane.OK_OPTION) { + PluginManager.getController().forbid(pluginMarker, modifyStatusCallback); + } + } else { + // 正常禁用 + PluginManager.getController().forbid(pluginMarker, modifyStatusCallback); + } + } else { + PluginManager.getController().enable(pluginMarker, modifyStatusCallback); + } + } + }); } public static void uninstallPlugin(final String pluginInfo, final boolean isForce, final JSCallback jsCallback) { diff --git a/designer-base/src/main/java/com/fr/design/mainframe/ComponentReuseNotifyUtil.java b/designer-base/src/main/java/com/fr/design/mainframe/ComponentReuseNotifyUtil.java index 2175804dcf..2dc77bb62c 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/ComponentReuseNotifyUtil.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/ComponentReuseNotifyUtil.java @@ -12,7 +12,7 @@ import com.fr.design.notification.SnapChatKey; * Created by kerry on 5/8/21 */ public class ComponentReuseNotifyUtil { - private static final String COMPONENT_SNAP_CHAT_KEY = "com.fr.component.share-components"; + public static final String COMPONENT_SNAP_CHAT_KEY = "com.fr.component.share-components"; private ComponentReuseNotifyUtil() { diff --git a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java index 2925e03a84..a33aa91d5d 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java @@ -34,6 +34,7 @@ import com.fr.design.menu.KeySetUtils; import com.fr.design.menu.ShortCut; import com.fr.design.menu.ToolBarDef; import com.fr.design.roleAuthority.RolesAlreadyEditedPane; +import com.fr.design.ui.util.UIUtil; import com.fr.design.utils.DesignUtils; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.event.Event; @@ -101,6 +102,23 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt return context.contain(PluginModule.ExtraDesign, ShortCut.TEMPLATE_TREE); } }); + GeneralContext.listenPluginRunningChanged(new PluginEventListener() { + @Override + public void on(PluginEvent event) { + UIUtil.invokeLaterIfNeeded(new Runnable() { + @Override + public void run() { + DesignerFrameFileDealerPane.getInstance().refresh(); + DesignerFrameFileDealerPane.getInstance().stateChange(); + } + }); + } + }, new PluginFilter() { + @Override + public boolean accept(PluginContext context) { + return context.contain(PluginModule.ExtraDesign, App.MARK_STRING); + } + }); } private List otherToolbarStateChangeListeners = new ArrayList<>(); 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 1c23369734..4e3c82140f 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 @@ -7,11 +7,11 @@ import com.fr.base.io.BaseBook; import com.fr.base.iofile.attr.DesignBanCopyAttrMark; import com.fr.base.iofile.attr.TemplateIdAttrMark; import com.fr.base.iofile.attr.TemplateThemeAttrMark; +import com.fr.base.theme.TemplateTheme; import com.fr.base.theme.TemplateThemeCompatible; +import com.fr.base.theme.TemplateThemeConfig; import com.fr.base.theme.ThemedTemplate; import com.fr.base.vcs.DesignerMode; -import com.fr.base.theme.TemplateTheme; -import com.fr.base.theme.TemplateThemeConfig; import com.fr.decision.config.FSConfig; import com.fr.design.DesignModelAdapter; import com.fr.design.DesignState; @@ -70,14 +70,13 @@ import com.fr.general.ComparatorUtils; import com.fr.general.IOUtils; import com.fr.locale.InterProviderFactory; import com.fr.log.FineLoggerFactory; +import com.fr.nx.app.designer.toolbar.TemplateTransformer; import com.fr.nx.app.designer.utils.CptAndCptxCompatibilityUtil; import com.fr.nx.app.designer.utils.CptCompileUtil; import com.fr.nx.cptx.entry.metadata.CptxMetadata; import com.fr.nx.cptx.utils.CptxFileUtils; import com.fr.plugin.context.PluginContext; import com.fr.plugin.context.PluginRuntime; -import com.fr.nx.app.designer.toolbar.CompileAction; -import com.fr.nx.app.designer.toolbar.TemplateTransformer; import com.fr.plugin.injectable.PluginModule; import com.fr.plugin.manage.PluginFilter; import com.fr.plugin.observer.PluginEvent; @@ -644,6 +643,16 @@ public abstract class JTemplate> fireSuperTargetModified(); } + public void undoToCurrent() { + UIUtil.invokeLaterIfNeeded(new Runnable() { + @Override + public void run() { + BaseUndoState current = JTemplate.this.getUndoState(); + current.applyState(); + } + }); + } + /** * 模板更新 */ diff --git a/designer-base/src/main/java/com/fr/design/mainframe/reuse/ComponentReuseNotificationInfo.java b/designer-base/src/main/java/com/fr/design/mainframe/reuse/ComponentReuseNotificationInfo.java index 46ccef0990..ea8722f1b3 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/reuse/ComponentReuseNotificationInfo.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/reuse/ComponentReuseNotificationInfo.java @@ -9,6 +9,7 @@ import com.fr.stable.xml.XMLableReader; */ public class ComponentReuseNotificationInfo implements XMLable { public static final String XML_TAG = "ComponentReuseNotificationInfo"; + private static final int INVALID_NUM = -1; private static final ComponentReuseNotificationInfo INSTANCE = new ComponentReuseNotificationInfo(); @@ -86,6 +87,19 @@ public class ComponentReuseNotificationInfo implements XMLable { this.historyCreatedReuses = historyCreatedReuses; } + //兼容老版本云端埋点的记录 + public long getLastNotifyTime() { + return INVALID_NUM; + } + + public int getNotifiedNumber() { + return INVALID_NUM; + } + + public long getLastGuidePopUpTime() { + return INVALID_NUM; + } + @Override public void readXML(XMLableReader reader) { this.setClickedWidgetLib(reader.getAttrAsBoolean("clickedWidgetLib", false)); diff --git a/designer-base/src/main/java/com/fr/design/utils/gui/AdjustWorkBookDefaultStyleUtils.java b/designer-base/src/main/java/com/fr/design/utils/gui/AdjustWorkBookDefaultStyleUtils.java index aa2178ece0..c26bda4cdd 100644 --- a/designer-base/src/main/java/com/fr/design/utils/gui/AdjustWorkBookDefaultStyleUtils.java +++ b/designer-base/src/main/java/com/fr/design/utils/gui/AdjustWorkBookDefaultStyleUtils.java @@ -18,6 +18,16 @@ public class AdjustWorkBookDefaultStyleUtils { private static final Color TEMPLATE_BACKGROUND = new Color(16, 11, 43); private static final Color CELL_ELEMENT_BORDER = new Color(110, 110, 110); + private static Color currentStoryBack = null; + + public static void setCurrentStoryBack(Color color) { + currentStoryBack = color; + } + + private static Color getCurrentStoryBack() { + return currentStoryBack == null ? TEMPLATE_BACKGROUND : currentStoryBack; + } + public static void adjustCellElement(CellElement cellElement) { if (DesignModeContext.isDuchampMode()) { Style style = cellElement.getStyle(); @@ -33,14 +43,14 @@ public class AdjustWorkBookDefaultStyleUtils { public static void adjustFloatElement(FloatElement floatElement) { if (DesignModeContext.isDuchampMode()) { Style style = floatElement.getStyle(); - style = style.deriveBackground(ColorBackground.getInstance(TEMPLATE_BACKGROUND)); + style = style.deriveBackground(ColorBackground.getInstance(getCurrentStoryBack())); style = style.deriveFRFont(style.getFRFont().applyForeground(Color.WHITE)); floatElement.setStyle(style); } } public static Color adjustBack(Color color) { - return DesignModeContext.isDuchampMode() ? TEMPLATE_BACKGROUND : color; + return DesignModeContext.isDuchampMode() ? getCurrentStoryBack() : color; } /** diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/LayoutAdapter.java b/designer-form/src/main/java/com/fr/design/designer/beans/LayoutAdapter.java index 438699b86c..3c0c2bd5f2 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/LayoutAdapter.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/LayoutAdapter.java @@ -140,5 +140,4 @@ public interface LayoutAdapter { default void dragOver(XCreator xCreator, SelectionModel selectionModel, int x, int y) { }; - } diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/AbstractLayoutAdapter.java b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/AbstractLayoutAdapter.java index 98b6c88558..7d287e5a5a 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/AbstractLayoutAdapter.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/AbstractLayoutAdapter.java @@ -13,7 +13,7 @@ import com.fr.design.utils.ComponentUtils; import com.fr.design.utils.gui.LayoutUtils; import com.fr.general.ComparatorUtils; -import java.awt.*; +import java.awt.LayoutManager; public abstract class AbstractLayoutAdapter implements LayoutAdapter { @@ -209,6 +209,4 @@ public abstract class AbstractLayoutAdapter implements LayoutAdapter { selectionModel.removeCreator(xCreator, xCreator.getWidth(), xCreator.getHeight()); selectionModel.setSelectedCreator(container); } - - } diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRBorderLayoutAdapter.java b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRBorderLayoutAdapter.java index cbb8f018f2..6a9eadf838 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRBorderLayoutAdapter.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRBorderLayoutAdapter.java @@ -184,5 +184,4 @@ public class FRBorderLayoutAdapter extends AbstractLayoutAdapter { public ConstraintsGroupModel getLayoutConstraints(XCreator creator) { return new FRBorderLayoutConstraints(container, creator); } - } diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRCardMainBorderLayoutAdapter.java b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRCardMainBorderLayoutAdapter.java index dd9e03c8db..13910f7d41 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRCardMainBorderLayoutAdapter.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRCardMainBorderLayoutAdapter.java @@ -1,13 +1,15 @@ package com.fr.design.designer.beans.adapters.layout; +import com.fr.design.designer.beans.models.AddingModel; import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XLayoutContainer; import com.fr.design.designer.creator.cardlayout.XWCardTagLayout; import com.fr.design.dialog.FineJOptionPane; import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.form.layout.FRBorderLayout; +import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.JTemplate; -import com.fr.design.ui.util.UIUtil; +import com.fr.design.mainframe.WidgetPropertyPane; import com.fr.general.ComparatorUtils; import java.awt.BorderLayout; @@ -65,18 +67,13 @@ public class FRCardMainBorderLayoutAdapter extends FRBorderLayoutAdapter { if (minConstraint > value) { FineJOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Beyond_Tablayout_Bounds")); JTemplate jt = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); - if (jt != null && jt.getUndoManager().canUndo()) { - // 自适应布局平分高度导致变矮的场景,优先做撤销 - UIUtil.invokeLaterIfNeeded(new Runnable() { - @Override - public void run() { - jt.undo(); - } - }); - } else if (container.getBackupBound() != null) { - // 手动拖动导致变矮的场景 - container.setSize(container.getBackupBound().getSize()); + if (jt != null) { + jt.undoToCurrent(); } + + FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner(); + AddingModel model = formDesigner.getAddingModel(); + model.setAddedIllegal(true); return true; } else { return false; diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java index d17e9689e6..9871d1b32f 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java @@ -1243,5 +1243,5 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter { public void dragOver(XCreator xCreator, SelectionModel selectionModel,int x, int y) { frLayoutState.dragOver(xCreator, selectionModel,x,y); - }; + } } diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/models/AddingModel.java b/designer-form/src/main/java/com/fr/design/designer/beans/models/AddingModel.java index 1926b57b13..ba0cf5dd05 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/models/AddingModel.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/models/AddingModel.java @@ -24,6 +24,7 @@ public class AddingModel { private int currentX; private int currentY; private boolean added; + private boolean addedIllegal = false; // 有时候是添加完成了,但是添加会造成某些控件size不合法,例如tab public AddingModel(FormDesigner designer, XCreator xCreator) { this.creator = xCreator; @@ -141,4 +142,11 @@ public class AddingModel { return added; } + public boolean isAddedIllegal() { + return addedIllegal; + } + + public void setAddedIllegal(boolean addedIllegal) { + this.addedIllegal = addedIllegal; + } } diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/models/SelectionModel.java b/designer-form/src/main/java/com/fr/design/designer/beans/models/SelectionModel.java index 963f60e6c3..31bb62531d 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/models/SelectionModel.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/models/SelectionModel.java @@ -25,7 +25,6 @@ import com.fr.design.fun.FormWidgetOptionProvider; import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.FormSelection; import com.fr.design.mainframe.FormSelectionUtils; -import com.fr.design.mainframe.share.encrypt.clipboard.impl.EncryptSelectionClipboardHandler; import com.fr.design.utils.ComponentUtils; import com.fr.design.utils.gui.LayoutUtils; import com.fr.general.ComparatorUtils; diff --git a/designer-form/src/main/java/com/fr/design/mainframe/DesignerTransferHandler.java b/designer-form/src/main/java/com/fr/design/mainframe/DesignerTransferHandler.java index 38e6f47a4d..e5b11dd9a4 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/DesignerTransferHandler.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/DesignerTransferHandler.java @@ -1,12 +1,11 @@ package com.fr.design.mainframe; -import java.awt.datatransfer.Transferable; +import com.fr.design.designer.beans.models.AddingModel; +import com.fr.design.file.HistoryTemplateListPane; import javax.swing.JComponent; import javax.swing.TransferHandler; - -import com.fr.design.designer.beans.events.DesignerEvent; -import com.fr.design.designer.beans.models.AddingModel; +import java.awt.datatransfer.Transferable; public class DesignerTransferHandler extends TransferHandler { @@ -21,7 +20,14 @@ public class DesignerTransferHandler extends TransferHandler { protected void exportDone(JComponent source, Transferable data, int action) { if (!addingModel.isCreatorAdded()) { - designer.getEditListenerTable().fireCreatorModified(DesignerEvent.CREATOR_CUTED); + undoWhenAddingFailed(); + } + } + + private void undoWhenAddingFailed() { + JTemplate jt = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); + if (jt != null) { + jt.undoToCurrent(); } } } \ No newline at end of file diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java b/designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java index 82befa2731..6efc496f8f 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java @@ -144,7 +144,10 @@ public class FormCreatorDropTarget extends DropTarget { designer.getSelectionModel().setSelectedCreators( FormSelectionUtils.rebuildSelection(xCreator, new Widget[]{widget})); - designer.getEditListenerTable().fireCreatorModified(addingModel.getXCreator(), DesignerEvent.CREATOR_ADDED); + if (!addingModel.isAddedIllegal()) { + designer.getEditListenerTable().fireCreatorModified(addingModel.getXCreator(), DesignerEvent.CREATOR_ADDED); + } + tabDragInner.tryDragIn(); } else { Toolkit.getDefaultToolkit().beep(); // 拖入失败 取消选中 diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java b/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java index 205316cd17..93427ab2bb 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java @@ -33,6 +33,7 @@ import java.util.List; * Time: 下午8:18 */ public class FormWidgetDetailPane extends FormDockView { + private static final int LOCAL_TAB = 0; private static final int ONLINE_TAB = 1; private JPanel centerPane; @@ -108,7 +109,7 @@ public class FormWidgetDetailPane extends FormDockView { cardLayout.show(centerPane, paneList.get(newSelectedIndex).getTitle()); } }; - headGroup.setSelectedIndex(ComponentShareUtil.needSwitch2OnlineTab() ? ONLINE_TAB : 0); + headGroup.setSelectedIndex(ComponentShareUtil.needSwitch2OnlineTab() ? ONLINE_TAB : LOCAL_TAB); this.add(headGroup, BorderLayout.NORTH); this.add(centerPane, BorderLayout.CENTER); } @@ -155,11 +156,11 @@ public class FormWidgetDetailPane extends FormDockView { } public void switch2Local() { - cardLayout.show(centerPane, paneList.get(0).getTitle()); + headGroup.setSelectedIndex(LOCAL_TAB); } - public void swich2Online() { - cardLayout.show(centerPane, paneList.get(1).getTitle()); + public void switch2Online() { + headGroup.setSelectedIndex(ONLINE_TAB); } private UILabel tipLabel(String text) { diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/PreviewWidgetBlock.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/PreviewWidgetBlock.java index 425e3e1ca3..e77ea8112a 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/PreviewWidgetBlock.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/PreviewWidgetBlock.java @@ -237,7 +237,7 @@ public abstract class PreviewWidgetBlock extends JPanel implements MouseListe lastStallTime = System.currentTimeMillis(); Dimension dimension = getCoverDimension(); Rectangle containerRec = new Rectangle(0, 0, dimension.width, dimension.height); - if (!isRightClickPopupMenuVisible()) { + if (!isRightClickPopupMenuVisible() && !FirstDragAnimateStateManager.getInstance().animating()) { if (containerRec.contains(e.getX(), e.getY())) { this.showPreviewPane(); } else { 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 d2ad2d6f5c..fd050513ba 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 @@ -92,6 +92,7 @@ public class LocalWidgetRepoPane extends BasicPane { container.setLayout(new BorderLayout()); updateTipPane = createUpdateTipPane(); + updateTipPane.setVisible(false); container.add(updateTipPane, BorderLayout.NORTH); updateProgressPane = createUpdateMaskPane(); diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/AbstractOnlineWidgetShowPane.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/AbstractOnlineWidgetShowPane.java index 1e5899f46f..ef61c1e94e 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/AbstractOnlineWidgetShowPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/AbstractOnlineWidgetShowPane.java @@ -43,6 +43,7 @@ public abstract class AbstractOnlineWidgetShowPane extends JPanel { protected FilterPane filterPane; private JPanel centerPane; private SortTabPane sortTabPane; + private JPanel toolBarPane; private final JPanel loadingPane = new LoadingPane(); @@ -77,10 +78,10 @@ public abstract class AbstractOnlineWidgetShowPane extends JPanel { FlexSearchFieldPane flexSearchPane = new FlexSearchFieldPane(filterPane); initSearchTextFieldPaneListener(flexSearchPane); - JPanel northPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - northPane.add(flexSearchPane, BorderLayout.CENTER); - northPane.add(sortTabPane, BorderLayout.SOUTH); - initNorthPane(jPanel, northPane); + toolBarPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + toolBarPane.add(flexSearchPane, BorderLayout.CENTER); + toolBarPane.add(sortTabPane, BorderLayout.SOUTH); + initNorthPane(jPanel, toolBarPane); this.searchResultShowPane = initSearchResultShowPane(sharableWidgetProviders); mainCardLayout = new CardLayout(); @@ -93,10 +94,15 @@ public abstract class AbstractOnlineWidgetShowPane extends JPanel { return jPanel; } + protected void initNorthPane(JPanel jPanel, JPanel northPane) { jPanel.add(northPane, BorderLayout.NORTH); } + public void setToolBarPaneVisible(boolean flag){ + this.toolBarPane.setVisible(flag); + } + protected AbstractOnlineWidgetSelectPane createOnlineWidgetSelectPane(OnlineShareWidget[] sharableWidgetProviders) { return new OnlineWidgetSelectPane(sharableWidgetProviders, filterPane, 50); diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/OnlineWidgetPopupPreviewPane.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/OnlineWidgetPopupPreviewPane.java index ab1793519b..d7311db3e3 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/OnlineWidgetPopupPreviewPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/OnlineWidgetPopupPreviewPane.java @@ -23,11 +23,8 @@ import javax.swing.plaf.basic.BasicLabelUI; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; -import java.awt.Graphics; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; -import java.awt.Image; -import java.awt.Toolkit; /** * @author Starryi @@ -35,7 +32,7 @@ import java.awt.Toolkit; * Created by Starryi on 2021/9/14 */ public class OnlineWidgetPopupPreviewPane extends AbstractWidgetPopupPreviewPane { - private static final int POPUP_WIDTH = 412; + public static final int POPUP_WIDTH = 412; private static final int POPUP_TOP_HEIGHT = 28; private static final int POPUP_BOTTOM_HEIGHT = 54; @@ -221,33 +218,4 @@ public class OnlineWidgetPopupPreviewPane extends AbstractWidgetPopupPreviewPane compatibleEnVersionLabel.setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Share_Compatible_Designer_Version") + ": " + compatibleEnVersion); } - - private static class PreviewImagePane extends JPanel { - private static final Image DEFAULT_IMAGE = IOUtils.readImage("com/fr/base/images/share/component_error.png"); - private static final int PREVIEW_IMAGE_WIDTH = POPUP_WIDTH - 20; - private static final int STANDARD_DPI = 128; - - private Image previewImage; - - public void setPreviewImage(Image previewImage) { - this.previewImage = previewImage; - if (this.previewImage == null) { - this.previewImage = DEFAULT_IMAGE; - } - - int dpi = Toolkit.getDefaultToolkit().getScreenResolution(); - int imageWidth = this.previewImage.getWidth(null); - int imageHeight = this.previewImage.getHeight(null); - - double imageAspectRatio = (double) imageWidth / imageHeight; - int width = (PREVIEW_IMAGE_WIDTH * dpi) / STANDARD_DPI; - int height = (int) (width / imageAspectRatio); - setPreferredSize(new Dimension(width, height)); - } - - @Override - public void paint(Graphics g) { - g.drawImage(this.previewImage, 0, 0, getWidth(), getHeight(), null); - } - } } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/PreviewImagePane.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/PreviewImagePane.java new file mode 100644 index 0000000000..bedcb4e2fb --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/PreviewImagePane.java @@ -0,0 +1,41 @@ +package com.fr.design.mainframe.share.ui.online; + +import com.fr.general.IOUtils; + +import javax.swing.JPanel; +import java.awt.Dimension; +import java.awt.Graphics; +import java.awt.Image; +import java.awt.Toolkit; + +/** + * Created by kerry on 2021/11/19 + */ +public class PreviewImagePane extends JPanel { + private static final Image DEFAULT_IMAGE = IOUtils.readImage("com/fr/base/images/share/component_error.png"); + private static final int PREVIEW_IMAGE_WIDTH = OnlineWidgetPopupPreviewPane.POPUP_WIDTH - 20; + private static final int STANDARD_DPI = 128; + + private Image previewImage; + + public void setPreviewImage(Image previewImage) { + this.previewImage = previewImage; + if (this.previewImage == null) { + this.previewImage = DEFAULT_IMAGE; + } + + int dpi = Toolkit.getDefaultToolkit().getScreenResolution(); + int imageWidth = this.previewImage.getWidth(null); + int imageHeight = this.previewImage.getHeight(null); + + double imageAspectRatio = (double) imageWidth / imageHeight; + int width = (PREVIEW_IMAGE_WIDTH * dpi) / STANDARD_DPI; + int height = (int) (width / imageAspectRatio); + setPreferredSize(new Dimension(width, height)); + } + + @Override + public void paint(Graphics g) { + g.drawImage(this.previewImage, 0, 0, getWidth(), getHeight(), null); + } +} diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/EmbedPane.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/EmbedPane.java index bf535b367f..c9562b1dac 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/EmbedPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/EmbedPane.java @@ -7,6 +7,7 @@ import com.fr.design.gui.ibutton.UIButtonUI; import com.fr.design.gui.ilable.UILabel; import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.share.collect.ComponentCollector; import com.fr.design.mainframe.share.ui.widgetfilter.FilterConfigPane; import com.fr.design.mainframe.share.util.OnlineShopUtils; @@ -18,10 +19,13 @@ import com.fr.stable.StringUtils; import javax.swing.BorderFactory; import javax.swing.JPanel; import javax.swing.UIManager; +import java.awt.AlphaComposite; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; +import java.awt.FontMetrics; import java.awt.Graphics; +import java.awt.Graphics2D; import java.awt.Image; import java.awt.Point; import java.awt.event.ActionEvent; @@ -41,7 +45,9 @@ public class EmbedPane extends JPanel { private static final String EMBED_PANE_TIMER = "EMBED_PANE_TIMER"; private static final Color BORDER_COLOR = Color.decode("#D9DADD"); private static final Color SEARCH_BUTTON_COLOR = Color.decode("#419BF9"); + private static final float DELTA_ALPHA = 0.13F; private Image image; + private float alpha = 1.0F; public EmbedPane(OnlineEmbedFilterShowPane showPane) { this.addMouseListener(new MouseAdapter() { @@ -54,8 +60,7 @@ public class EmbedPane extends JPanel { private JPanel initCenterPane(OnlineEmbedFilterShowPane showPane) { JPanel jPanel = new JPanel(FRGUIPaneFactory.createBorderLayout()); jPanel.setBackground(Color.WHITE); - jPanel.setPreferredSize(new Dimension(200, 200)); - jPanel.setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 0)); + jPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 0)); FilterConfigPane filterConfigPane = new FilterConfigPane(OnlineShopUtils.getEmbPaneShowFilterTypeInfos(), false) { @Override @@ -65,9 +70,9 @@ public class EmbedPane extends JPanel { }; UIButton searchBtn = initSearchBtn(filterConfigPane, showPane); filterConfigPane.setBorder(null); - UILabel tipLabel = new UILabel(Toolkit.i18nText("Fine-Design_Share_Online_Embed_Filter_Tip")); - tipLabel.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5)); - jPanel.add(tipLabel, BorderLayout.NORTH); + JPanel tipPane = getFilterTipPane(); + tipPane.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5)); + jPanel.add(tipPane, BorderLayout.NORTH); jPanel.add(filterConfigPane, BorderLayout.CENTER); JPanel southPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); southPane.setBorder(BorderFactory.createEmptyBorder(0, 8, 0, 8)); @@ -79,6 +84,43 @@ public class EmbedPane extends JPanel { return jPanel; } + private JPanel getFilterTipPane() { + String remark = Toolkit.i18nText("Fine-Design_Share_Online_Embed_Filter_Tip"); + UILabel label = new UILabel(); + label.setSize(new Dimension(212, 30)); + + //用THML标签进行拼接,以实现自动换行 + StringBuilder builder = new StringBuilder(""); + char[] chars = remark.toCharArray(); + //获取字体计算大小 + FontMetrics fontMetrics = label.getFontMetrics(label.getFont()); + int start = 0; + int len = 0; + while (start + len < remark.length()) { + while (true) { + len++; + if (start + len > remark.length()) + break; + if (fontMetrics.charsWidth(chars, start, len) + > label.getWidth()) { + break; + } + } + builder.append(chars, start, len - 1).append("
"); + start = start + len - 1; + len = 0; + } + //拼接剩余部分 + builder.append(chars, start, remark.length() - start); + builder.append(""); + + JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); + label.setText(builder.toString()); + jPanel.add(label); + + return jPanel; + } + private UIButton initSearchBtn(FilterConfigPane filterConfigPane, OnlineEmbedFilterShowPane showPane) { UIButton searchBtn = new UIButton(Toolkit.i18nText("Fine-Design_Share_Online_Query_Recommend_Component")); searchBtn.setUI(new UIButtonUI() { @@ -86,7 +128,7 @@ public class EmbedPane extends JPanel { protected void paintBorder(Graphics g, UIButton b) { Color oldColor = g.getColor(); g.setColor(SEARCH_BUTTON_COLOR); - g.drawRoundRect(0, 0, b.getWidth() - 4, b.getHeight() - 4, 2, 2); + g.drawRoundRect(2, 2, b.getWidth() - 4, b.getHeight() - 4, 2, 2); g.setColor(oldColor); } }); @@ -96,7 +138,7 @@ public class EmbedPane extends JPanel { public void actionPerformed(ActionEvent e) { String filterStr = filterConfigPane.assembleFilter(); if (StringUtils.isEmpty(filterStr)) { - FineJOptionPane.showMessageDialog(EmbedPane.this, + FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Share_Online_Embed_Filter_Warning_Tip"), Toolkit.i18nText("Fine-Design_Basic_Message"), WARNING_MESSAGE, UIManager.getIcon("OptionPane.warningIcon")); @@ -134,6 +176,7 @@ public class EmbedPane extends JPanel { Dimension newDimension = new Dimension(dimension.width - 25, dimension.height - 30); EmbedPane.this.setSize(newDimension); EmbedPane.this.setLocation(point.x + 25, 0); + alpha -= DELTA_ALPHA; }); }, 0, 60, TimeUnit.MILLISECONDS); @@ -141,6 +184,8 @@ public class EmbedPane extends JPanel { @Override public void paint(Graphics g) { + AlphaComposite composite = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, Math.max(0, alpha)); + ((Graphics2D) g).setComposite(composite); super.paint(g); if (image != null) { g.drawImage(image, 0, 0, EmbedPane.this.getWidth(), EmbedPane.this.getHeight(), null); diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/OnlineEmbedFilterSelectPane.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/OnlineEmbedFilterSelectPane.java index 120a396b62..3f4cea2a08 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/OnlineEmbedFilterSelectPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/OnlineEmbedFilterSelectPane.java @@ -7,9 +7,13 @@ import com.fr.design.mainframe.share.ui.online.CarouselStateManger; import com.fr.design.mainframe.share.ui.widgetfilter.FilterPane; import com.fr.form.share.base.DataLoad; import com.fr.form.share.bean.OnlineShareWidget; +import com.fr.form.share.constants.ShareComponentConstants; import com.fr.form.share.exception.NetWorkFailedException; import com.fr.general.http.HttpClient; +import com.fr.log.FineLoggerFactory; import com.fr.module.ModuleContext; +import com.fr.stable.EncodeConstants; +import com.fr.third.springframework.web.util.UriUtils; import javax.imageio.ImageIO; import javax.swing.JPanel; @@ -22,6 +26,7 @@ import java.awt.Rectangle; import java.awt.event.AWTEventListener; import java.awt.event.MouseEvent; import java.io.IOException; +import java.io.UnsupportedEncodingException; import java.net.HttpURLConnection; import java.util.concurrent.CountDownLatch; import java.util.concurrent.ScheduledExecutorService; @@ -96,6 +101,12 @@ public class OnlineEmbedFilterSelectPane extends AbstractOnlineWidgetSelectPane } private Image getPreviewImage(String url) throws NetWorkFailedException { + try { + url = UriUtils.encodePath(url, EncodeConstants.ENCODING_UTF_8); + } catch (UnsupportedEncodingException e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + return ShareComponentConstants.DEFAULT_COVER; + } HttpClient httpClient = new HttpClient(url); httpClient.setTimeout(CAROUSE_IMAGE_LOAD_TIMEOUT); httpClient.asGet(); diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/OnlineEmbedFilterShowPane.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/OnlineEmbedFilterShowPane.java index 9141bf98a0..640d84d737 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/OnlineEmbedFilterShowPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/OnlineEmbedFilterShowPane.java @@ -21,14 +21,23 @@ public class OnlineEmbedFilterShowPane extends JPanel { this.setLayout(FRGUIPaneFactory.createBorderLayout()); embedPane = new EmbedPane(this); embedPane.setLocation(10, 0); - embedPane.setSize(228, 273); - this.add(embedPane); + embedPane.setSize(228, embedPane.getPreferredSize().height); + this.add(embedPane, BorderLayout.NORTH); this.onlineWidgetShowPane = onlineWidgetShowPane; + this.onlineWidgetShowPane.setToolBarPaneVisible(false); this.add(onlineWidgetShowPane, BorderLayout.CENTER); } public void filterStateChanged(String filterStr) { + this.removeAll(); + this.add(embedPane); + this.add(onlineWidgetShowPane, BorderLayout.CENTER); + this.validate(); + this.doLayout(); + this.repaint(); + onlineWidgetShowPane.setToolBarPaneVisible(true); selectPane = onlineWidgetShowPane.animate(filterStr); + } public void animate(List selectedFilters) throws InterruptedException { diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/PreviewDialog.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/PreviewDialog.java index 3ef29c8cb6..2edd7d0945 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/PreviewDialog.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/PreviewDialog.java @@ -1,10 +1,8 @@ package com.fr.design.mainframe.share.ui.online.embed; -import com.fr.design.gui.ilable.UILabel; import com.fr.design.mainframe.DesignerContext; -import com.fr.design.mainframe.EastRegionContainerPane; +import com.fr.design.mainframe.share.ui.online.PreviewImagePane; -import javax.swing.ImageIcon; import javax.swing.JDialog; import java.awt.Dimension; import java.awt.Image; @@ -25,12 +23,13 @@ public class PreviewDialog extends JDialog { public void setImage(Image image, Point point) { this.getContentPane().removeAll(); - this.getContentPane().add(new UILabel(new ImageIcon(image))); - int width = image.getWidth(null); - this.setSize(width, image.getHeight(null)); - this.setLocation(point.x - width, point.y + OFFSET_Y); + PreviewImagePane previewImagePane = new PreviewImagePane(); + previewImagePane.setPreviewImage(image); + Dimension dimension = previewImagePane.getPreferredSize(); + this.getContentPane().add(previewImagePane); + setSize(new Dimension(dimension.width, dimension.height)); + this.setLocation(point.x - dimension.width, point.y + OFFSET_Y); this.doLayout(); - this.validate(); this.repaint(); } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/app/FormApp.java b/designer-realize/src/main/java/com/fr/design/mainframe/app/FormApp.java index 972df0cc8c..bcc7d26fb6 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/app/FormApp.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/app/FormApp.java @@ -82,7 +82,7 @@ class FormApp extends AbstractAppProvider { OpenResult result = worker.getResult(); if (result != null) { return (JTemplate) StableFactory.getMarkedInstanceObjectFromClass(BaseJForm.XML_TAG, - new Object[]{result.getBaseBook(), tplFile, new Parameter[0]}, classType, BaseJForm.class); + new Object[]{result.getBaseBook(), tplFile, result.getRef()}, classType, BaseJForm.class); } return emptyForm; } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/layout/UseLayoutAndComponentGuide.java b/designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/layout/UseLayoutAndComponentGuide.java index 78e75d8f20..b4f5647c66 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/layout/UseLayoutAndComponentGuide.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/layout/UseLayoutAndComponentGuide.java @@ -191,7 +191,7 @@ public class UseLayoutAndComponentGuide { Component component = ComponentUtils.findComponentByName(newFormPane.getWindow().getContentPane(), UIDialog.OK_BUTTON); if (component != null) { scene.addClickTarget(component, ClickScene.ClickType.LEFT); - scene.addBubbleTip(Toolkit.i18nText("Fine-Design_Guide_Scene_Base_Tip_Click_Confirm"), GuideTip.Direction.TOP); + scene.addBubbleTip(Toolkit.i18nText("Fine-Design_Guide_Scene_Base_Tip_Click", Toolkit.i18nText("Fine-Design_Report_OK")), GuideTip.Direction.TOP); } return super.prepared(); } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/theme/DownloadComponentPackageGuide.java b/designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/theme/DownloadComponentPackageGuide.java index e9b1b8fc3e..8e7c14297c 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/theme/DownloadComponentPackageGuide.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/theme/DownloadComponentPackageGuide.java @@ -29,6 +29,7 @@ import com.fr.design.mainframe.guide.tip.GuideTip; import com.fr.design.mainframe.share.ui.block.OnlineWidgetPackageBlock; import com.fr.design.mainframe.share.ui.online.OnlineWidgetRepoPane; import com.fr.design.mainframe.share.ui.online.OnlineWidgetTabPane; +import com.fr.design.mainframe.share.ui.online.widgetpackage.OnlineWidgetPackagesShowPane; import com.fr.design.mainframe.share.util.DownloadUtils; import com.fr.design.mainframe.share.util.OnlineShopUtils; import com.fr.design.utils.ComponentUtils; @@ -102,22 +103,23 @@ public class DownloadComponentPackageGuide { EastRegionContainerPane.getInstance().showContainer(); EastRegionContainerPane.getInstance().switchTabTo(EastRegionContainerPane.KEY_WIDGET_SETTINGS); OnlineWidgetRepoPane onlineWidgetRepoPane = OnlineWidgetRepoPane.getInstance(); - onlineWidgetRepoPane.setContent(); - OnlineWidgetTabPane tabPane = (OnlineWidgetTabPane) ComponentUtils.findComponentByClass(onlineWidgetRepoPane, OnlineWidgetTabPane.class); - UITabGroup tabGroup = (UITabGroup) ComponentUtils.findComponentByClass(tabPane, UITabGroup.class); - JPanel centerPane = (JPanel) tabPane.getComponent(1); - if (centerPane.getComponentCount() > 0) { + Component onlineWidgetPackagesShowPane = ComponentUtils.findComponentByClass(onlineWidgetRepoPane, OnlineWidgetPackagesShowPane.class); + if (onlineWidgetPackagesShowPane != null) { GuideManager.getInstance().getCurrentGuide().start(); } else { + onlineWidgetRepoPane.setContent(); + OnlineWidgetTabPane tabPane = (OnlineWidgetTabPane) ComponentUtils.findComponentByClass(onlineWidgetRepoPane, OnlineWidgetTabPane.class); + JPanel centerPane = (JPanel) tabPane.getComponent(1); centerPane.addContainerListener(new ContainerAdapter() { @Override public void componentAdded(ContainerEvent e) { - GuideManager.getInstance().getCurrentGuide().start(); + if (e.getChild() instanceof OnlineWidgetPackagesShowPane) { + GuideManager.getInstance().getCurrentGuide().start(); + } } }); } - tabGroup.setSelectedIndex(1); - tabGroup.tabChanged(1); + switch2OnlinePackageBlock(); } else { GuideCreateUtils.showNoNetworkAlert(); GuideManager.getInstance().getCurrentGuide().terminate(); @@ -168,7 +170,7 @@ public class DownloadComponentPackageGuide { @Override public boolean onComplete() { - FormWidgetDetailPane.getInstance().swich2Online(); + FormWidgetDetailPane.getInstance().switch2Online(); return true; } }); @@ -270,7 +272,7 @@ public class DownloadComponentPackageGuide { public boolean prepared() { Component target = ComponentUtils.findComponentByClass(themeConfirmDialog.getContentPane(), UIButton.class); scene.addClickTarget(target, ClickScene.ClickType.LEFT); - scene.addBubbleTip(Toolkit.i18nText("Fine-Design_Guide_Scene_Base_Tip_Click_Confirm"), GuideTip.Direction.BOTTOM); + scene.addBubbleTip(Toolkit.i18nText("Fine-Design_Guide_Scene_Base_Tip_Click_Confirm", Toolkit.i18nText("Fine-Design_Basic_Confirm")), GuideTip.Direction.BOTTOM); return super.prepared(); } @@ -298,4 +300,11 @@ public class DownloadComponentPackageGuide { themeConfirmDialog.dispose(); } } + + private static void switch2OnlinePackageBlock() { + OnlineWidgetTabPane tabPane = (OnlineWidgetTabPane) ComponentUtils.findComponentByClass(OnlineWidgetRepoPane.getInstance(), OnlineWidgetTabPane.class); + UITabGroup tabGroup = (UITabGroup) ComponentUtils.findComponentByClass(tabPane, UITabGroup.class); + tabGroup.setSelectedIndex(1); + tabGroup.tabChanged(1); + } } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/theme/ThemeToggleGuide.java b/designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/theme/ThemeToggleGuide.java index 3ab6234a3a..61dffc156b 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/theme/ThemeToggleGuide.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/theme/ThemeToggleGuide.java @@ -173,7 +173,7 @@ public class ThemeToggleGuide { @Override public boolean prepared() { scene.addClickTarget(ComponentUtils.findComponentByName(themeDialog, TemplateThemeGridPagesPane.COMPLETE_BUTTON), ClickScene.ClickType.LEFT, true); - scene.addBubbleTip(Toolkit.i18nText("Fine-Design_Guide_Scene_Base_Tip_Click_Complete"), BubbleTip.Direction.TOP); + scene.addBubbleTip(Toolkit.i18nText("Fine-Design_Guide_Scene_Base_Tip_Click", Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Manager_Dialog_Close")), BubbleTip.Direction.TOP); return true; } diff --git a/designer-realize/src/main/java/com/fr/grid/GridMouseAdapter.java b/designer-realize/src/main/java/com/fr/grid/GridMouseAdapter.java index 11b6ae22b1..c2c1861147 100644 --- a/designer-realize/src/main/java/com/fr/grid/GridMouseAdapter.java +++ b/designer-realize/src/main/java/com/fr/grid/GridMouseAdapter.java @@ -879,12 +879,7 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous * @param e */ public void mouseWheelMoved(MouseWheelEvent e) { - if (!InputEventBaseOnOS.isControlDown(e)) { - ElementCasePane reportPane = grid.getElementCasePane(); - if (reportPane.isHorizontalScrollBarVisible()) { - reportPane.getVerticalScrollBar().setValue(reportPane.getVerticalScrollBar().getValue() + e.getWheelRotation() * 3); - } - } + } /**