Browse Source

Merge branch 'release/11.0' into feature/x

# Conflicts:
#	designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java
#	designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java
feature/x
Tommy 3 years ago
parent
commit
29a0b2f500
  1. 42
      designer-base/src/main/java/com/fr/design/extra/PluginOperateUtils.java
  2. 18
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java
  3. 17
      designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java
  4. 14
      designer-base/src/main/java/com/fr/design/utils/gui/AdjustWorkBookDefaultStyleUtils.java
  5. 1
      designer-form/src/main/java/com/fr/design/designer/beans/LayoutAdapter.java
  6. 4
      designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/AbstractLayoutAdapter.java
  7. 1
      designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRBorderLayoutAdapter.java
  8. 21
      designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRCardMainBorderLayoutAdapter.java
  9. 2
      designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java
  10. 8
      designer-form/src/main/java/com/fr/design/designer/beans/models/AddingModel.java
  11. 1
      designer-form/src/main/java/com/fr/design/designer/beans/models/SelectionModel.java
  12. 16
      designer-form/src/main/java/com/fr/design/mainframe/DesignerTransferHandler.java
  13. 5
      designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java
  14. 9
      designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java
  15. 2
      designer-realize/src/main/java/com/fr/design/mainframe/app/FormApp.java
  16. 2
      designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/layout/UseLayoutAndComponentGuide.java
  17. 29
      designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/theme/DownloadComponentPackageGuide.java
  18. 2
      designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/theme/ThemeToggleGuide.java

42
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) {

18
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<FileToolbarStateChangeListener> otherToolbarStateChangeListeners = new ArrayList<>();

17
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<T extends BaseBook, U extends BaseUndoState<?>>
fireSuperTargetModified();
}
public void undoToCurrent() {
UIUtil.invokeLaterIfNeeded(new Runnable() {
@Override
public void run() {
BaseUndoState current = JTemplate.this.getUndoState();
current.applyState();
}
});
}
/**
* 模板更新
*/

14
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;
}
/**

1
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) {
};
}

4
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);
}
}

1
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);
}
}

21
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;

2
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);
};
}
}

8
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;
}
}

1
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;

16
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();
}
}
}

5
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();
// 拖入失败 取消选中

9
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) {

2
designer-realize/src/main/java/com/fr/design/mainframe/app/FormApp.java

@ -82,7 +82,7 @@ class FormApp extends AbstractAppProvider {
OpenResult<Form, Parameter[]> result = worker.getResult();
if (result != null) {
return (JTemplate<Form, ?>) 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;
}

2
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();
}

29
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);
}
}

2
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;
}

Loading…
Cancel
Save