Browse Source

Merge pull request #6834 in DESIGN/design from release/10.0 to final/10.0

* commit 'b994b8bb8b935eae310a398ba2dea704d73a5799':
  REPORT-62275 tab高度弹窗撤销问题
  CHART-22020 【设计器】大屏编辑器-第一次启动设计器-插件加载成功后,reportlets根目录显示不了FVS模板,只有点击工具栏的刷新按钮才能出现
  REPORT-62275 tab高度弹窗撤销问题
  CHART-21785 cpt编辑状态背景和当前页面颜色背景一样 design
  REPORT-62554 再打开设计器模板会空白
  REPORT-60748 决策报表-属性-坐标尺寸交互问题
  CHART-21951 第三方图表插件无法创建复用组件
  REPORT-62088 来回切换两个单元格及其的排序按钮,几十次后,排序按钮点击
  CHART-21665 design fix:仪表盘刻度配色保存异常处理
  REPORT-62142 fix 解密条件 关注内置的两种模板类型即可
  REPORT-62142 加密模板在json数据集插件禁用启用后的模板数据集无法正常显示
  REPORT-62133 mac设计器安装包起不来
final/10.0
superman 3 years ago
parent
commit
36bb7d425e
  1. 47
      designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java
  2. 5
      designer-base/src/main/java/com/fr/design/gui/ibutton/UIButtonGroup.java
  3. 18
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java
  4. 10
      designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java
  5. 14
      designer-base/src/main/java/com/fr/design/utils/gui/AdjustWorkBookDefaultStyleUtils.java
  6. 6
      designer-base/src/main/java/com/fr/design/widget/WidgetBoundsPaneFactory.java
  7. 17
      designer-base/src/main/java/com/fr/file/StashedFILE.java
  8. 12
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/UIColorPickerPane.java
  9. 21
      designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRCardMainBorderLayoutAdapter.java
  10. 9
      designer-form/src/main/java/com/fr/design/designer/beans/models/AddingModel.java
  11. 5
      designer-form/src/main/java/com/fr/design/designer/creator/XChartEditor.java
  12. 8
      designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java
  13. 19
      designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java
  14. 5
      designer-form/src/main/java/com/fr/design/designer/creator/XElementCase.java
  15. 5
      designer-form/src/main/java/com/fr/design/designer/creator/XLayoutContainer.java
  16. 16
      designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java
  17. 11
      designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormSingleWidgetCardPane.java
  18. 2
      designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetAbsoluteBoundPane.java
  19. 15
      designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java
  20. 16
      designer-realize/src/main/java/com/fr/design/mainframe/app/FormApp.java
  21. 31
      designer-realize/src/main/java/com/fr/design/share/effect/EffectItemGroup.java

47
designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java

@ -12,7 +12,6 @@ import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.DesignerFrameFileDealerPane; import com.fr.design.mainframe.DesignerFrameFileDealerPane;
import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplate;
import com.fr.design.mainframe.JVirtualTemplate; import com.fr.design.mainframe.JVirtualTemplate;
import com.fr.design.module.DesignModuleFactory;
import com.fr.design.ui.util.UIUtil; import com.fr.design.ui.util.UIUtil;
import com.fr.file.FILE; import com.fr.file.FILE;
import com.fr.file.FileNodeFILE; import com.fr.file.FileNodeFILE;
@ -361,22 +360,30 @@ public class HistoryTemplateListCache implements CallbackEvent {
int size = historyList.size(); int size = historyList.size();
for (int i = 0; i < size; i++) { for (int i = 0; i < size; i++) {
JTemplate<?, ?> template = historyList.get(i); JTemplate<?, ?> template = historyList.get(i);
FILE file = template.getEditingFILE(); FILE file = templateToStashFile(template);
try { if (file != null) {
ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); stashFILEMap.put(i, file);
BaseBook target = template.getTarget();
if (target != null) {
target.export(outputStream);
stashFILEMap.put(i, new StashedFILE(file, outputStream.toByteArray()));
}
// 如果 target == null 那么这个模板是被模板内存优化功能处理过的,不用处理
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
} }
FineLoggerFactory.getLogger().info("Env Change Template Stashed."); 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() { private boolean checkStash() {
try { try {
return stashWorker.get(); return stashWorker.get();
@ -458,18 +465,10 @@ public class HistoryTemplateListCache implements CallbackEvent {
FILE file = template.getEditingFILE(); FILE file = template.getEditingFILE();
boolean needReload = context == null || needReloadTemplate(context, template); boolean needReload = context == null || needReloadTemplate(context, template);
if (needReload) { if (needReload) {
try { FILE stashFile = templateToStashFile(template);
ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); if (stashFile != null) {
BaseBook target = template.getTarget(); FineLoggerFactory.getLogger().info("{} is being reloaded", file.getName());
if (target != null) { template.refreshResource(stashFile);
FineLoggerFactory.getLogger().info("{} is being reloaded", file.getName());
target.export(outputStream);
FILE stashedFile = new StashedFILE(file, outputStream.toByteArray());
template.refreshResource(stashedFile);
}
// 如果 target == null 那么这个模板是被模板内存优化功能处理过的,不用处理
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
} }
} }

5
designer-base/src/main/java/com/fr/design/gui/ibutton/UIButtonGroup.java

@ -379,7 +379,10 @@ public class UIButtonGroup<T> extends JPanel implements GlobalNameObserver {
* @param l * @param l
*/ */
public void removeChangeListener(ChangeListener l) { public void removeChangeListener(ChangeListener l) {
this.listenerList.remove(ChangeListener.class, l); for (int i = 0; i < labelButtonList.size(); i++) {
labelButtonList.get(i).removeChangeListener(l);
listenerList.remove(ChangeListener.class, l);
}
} }

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.ShortCut;
import com.fr.design.menu.ToolBarDef; import com.fr.design.menu.ToolBarDef;
import com.fr.design.roleAuthority.RolesAlreadyEditedPane; import com.fr.design.roleAuthority.RolesAlreadyEditedPane;
import com.fr.design.ui.util.UIUtil;
import com.fr.design.utils.DesignUtils; import com.fr.design.utils.DesignUtils;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.event.Event; import com.fr.event.Event;
@ -101,6 +102,23 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
return context.contain(PluginModule.ExtraDesign, ShortCut.TEMPLATE_TREE); 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<>(); private List<FileToolbarStateChangeListener> otherToolbarStateChangeListeners = new ArrayList<>();

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

@ -581,6 +581,16 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
fireSuperTargetModified(); 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 TEMPLATE_BACKGROUND = new Color(16, 11, 43);
private static final Color CELL_ELEMENT_BORDER = new Color(110, 110, 110); 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) { public static void adjustCellElement(CellElement cellElement) {
if (DesignModeContext.isDuchampMode()) { if (DesignModeContext.isDuchampMode()) {
Style style = cellElement.getStyle(); Style style = cellElement.getStyle();
@ -33,14 +43,14 @@ public class AdjustWorkBookDefaultStyleUtils {
public static void adjustFloatElement(FloatElement floatElement) { public static void adjustFloatElement(FloatElement floatElement) {
if (DesignModeContext.isDuchampMode()) { if (DesignModeContext.isDuchampMode()) {
Style style = floatElement.getStyle(); 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)); style = style.deriveFRFont(style.getFRFont().applyForeground(Color.WHITE));
floatElement.setStyle(style); floatElement.setStyle(style);
} }
} }
public static Color adjustBack(Color color) { public static Color adjustBack(Color color) {
return DesignModeContext.isDuchampMode() ? TEMPLATE_BACKGROUND : color; return DesignModeContext.isDuchampMode() ? getCurrentStoryBack() : color;
} }
} }

6
designer-base/src/main/java/com/fr/design/widget/WidgetBoundsPaneFactory.java

@ -46,12 +46,12 @@ public class WidgetBoundsPaneFactory {
private static final int RIGHT_PANE_WIDTH = 145; private static final int RIGHT_PANE_WIDTH = 145;
public static UIExpandablePane createBoundsPane(UISpinner width, UISpinner height, JComponent ratioLocked) { public static UIExpandablePane createBoundsPane(UISpinner width, UISpinner height, JComponent ratioLocked, NameAttribute nameAttribute) {
JPanel boundsPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel boundsPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
double f = TableLayout.FILL; double f = TableLayout.FILL;
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{FRWidgetFactory.createLineWrapLabel(Toolkit.i18nText("Fine-Design_Basic_Component_Size")), new Component[]{FRWidgetFactory.createLineWrapLabel(nameAttribute.getSizeName()),
ratioLocked != null ? createRightPane(width, ratioLocked, height) : createRightPane(width, height)}, ratioLocked != null ? createRightPane(width, ratioLocked, height) : createRightPane(width, height)},
new Component[]{null, createRightPane(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Tree_Width"), SwingConstants.CENTER), new UILabel(Toolkit.i18nText("Fine-Design_Basic_Tree_Height"), SwingConstants.CENTER))}, new Component[]{null, createRightPane(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Tree_Width"), SwingConstants.CENTER), new UILabel(Toolkit.i18nText("Fine-Design_Basic_Tree_Height"), SwingConstants.CENTER))},
}; };
@ -65,7 +65,7 @@ public class WidgetBoundsPaneFactory {
} }
public static UIExpandablePane createBoundsPane(UISpinner width, UISpinner height) { public static UIExpandablePane createBoundsPane(UISpinner width, UISpinner height) {
return createBoundsPane(width, height, null); return createBoundsPane(width, height, null, NameAttribute.DEFAULT);
} }
public static JPanel createRightPane(Component com1, Component com2) { public static JPanel createRightPane(Component com1, Component com2) {

17
designer-base/src/main/java/com/fr/file/StashedFILE.java

@ -1,5 +1,9 @@
package com.fr.file; package com.fr.file;
import com.fr.base.io.XMLEncryptUtils;
import com.fr.io.EncryptUtils;
import com.fr.io.FineEncryptUtils;
import com.fr.stable.StringUtils;
import javax.swing.Icon; import javax.swing.Icon;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
import java.io.InputStream; import java.io.InputStream;
@ -11,10 +15,16 @@ public class StashedFILE extends AbstractFILE {
private FILE file; private FILE file;
private byte[] content; private byte[] content;
private String suffix;
public StashedFILE(FILE file, byte[] content) { public StashedFILE(FILE file, byte[] content) {
this(file, content, null);
}
public StashedFILE(FILE file, byte[] content, String suffix) {
this.file = file; this.file = file;
this.content = content; this.content = content;
this.suffix = suffix;
} }
@Override @Override
@ -54,7 +64,12 @@ public class StashedFILE extends AbstractFILE {
@Override @Override
public InputStream asInputStream() throws Exception { public InputStream asInputStream() throws Exception {
return new ByteArrayInputStream(content); ByteArrayInputStream in = new ByteArrayInputStream(content);
return needDecode() ? XMLEncryptUtils.decodeInputStream(EncryptUtils.decodeInputStream(FineEncryptUtils.decode(in))) : in;
}
private boolean needDecode() {
return StringUtils.isNotEmpty(suffix) && (suffix.endsWith(".cpt") || suffix.endsWith(".frm"));
} }
@Override @Override

12
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/UIColorPickerPane.java

@ -29,8 +29,6 @@ import javax.swing.JPanel;
import javax.swing.SwingConstants; import javax.swing.SwingConstants;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
import java.util.ArrayList;
import java.util.List;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Color; import java.awt.Color;
import java.awt.Component; import java.awt.Component;
@ -42,6 +40,8 @@ import java.awt.LayoutManager;
import java.awt.Point; import java.awt.Point;
import java.awt.event.MouseAdapter; import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.util.ArrayList;
import java.util.List;
public class UIColorPickerPane extends BasicPane implements UIObserver { public class UIColorPickerPane extends BasicPane implements UIObserver {
private static final int MARGIN_TOP = 7; private static final int MARGIN_TOP = 7;
@ -691,14 +691,18 @@ public class UIColorPickerPane extends BasicPane implements UIObserver {
fillStyleCombox.setSelectObject(mainColor); fillStyleCombox.setSelectObject(mainColor);
designTypeButtonGroup.setSelectedIndex(hotAreaColor.getUseType()); designTypeButtonGroup.setSelectedIndex(hotAreaColor.getUseType());
double value = (double) hotAreaColor.getAreaNumber(); int value = hotAreaColor.getAreaNumber();
UIColorPickerPane.this.add(textGroup); UIColorPickerPane.this.add(textGroup);
UIColorPickerPane.this.add(colorGroup); UIColorPickerPane.this.add(colorGroup);
Color[] colors = hotAreaColor.initColor(); Color[] colors = hotAreaColor.initColor();
BaseFormula[] values = hotAreaColor.initValues(); BaseFormula[] values = hotAreaColor.initValues();
if (value != colors.length && hotAreaColor.getUseType() == MapHotAreaColor.CUSTOM) {
colors = getColorArray(mainColor, value);
values = getValueArray(value);
}
refreshGroupPane(colors, values); refreshGroupPane(colors, values);
this.initContainerLister(); this.initContainerLister();
regionNumPane.populateBean(value); regionNumPane.populateBean((double) value);
refreshPane(); refreshPane();
} }

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; 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.XCreator;
import com.fr.design.designer.creator.XLayoutContainer; import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.designer.creator.cardlayout.XWCardTagLayout; import com.fr.design.designer.creator.cardlayout.XWCardTagLayout;
import com.fr.design.dialog.FineJOptionPane; import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.form.layout.FRBorderLayout; import com.fr.design.form.layout.FRBorderLayout;
import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.JTemplate; 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 com.fr.general.ComparatorUtils;
import java.awt.BorderLayout; import java.awt.BorderLayout;
@ -65,18 +67,13 @@ public class FRCardMainBorderLayoutAdapter extends FRBorderLayoutAdapter {
if (minConstraint > value) { if (minConstraint > value) {
FineJOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Beyond_Tablayout_Bounds")); FineJOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Beyond_Tablayout_Bounds"));
JTemplate<?, ?> jt = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); JTemplate<?, ?> jt = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
if (jt != null && jt.getUndoManager().canUndo()) { if (jt != null) {
// 自适应布局平分高度导致变矮的场景,优先做撤销 jt.undoToCurrent();
UIUtil.invokeLaterIfNeeded(new Runnable() {
@Override
public void run() {
jt.undo();
}
});
} else if (container.getBackupBound() != null) {
// 手动拖动导致变矮的场景
container.setSize(container.getBackupBound().getSize());
} }
FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner();
AddingModel model = formDesigner.getAddingModel();
model.setAddedIllegal(true);
return true; return true;
} else { } else {
return false; return false;

9
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 currentX;
private int currentY; private int currentY;
private boolean added; private boolean added;
private boolean addedIllegal = false; // 有时候是添加完成了,但是添加会造成某些控件size不合法,例如tab
public AddingModel(FormDesigner designer, XCreator xCreator) { public AddingModel(FormDesigner designer, XCreator xCreator) {
this.creator = xCreator; this.creator = xCreator;
@ -142,4 +143,12 @@ public class AddingModel {
y + designer.getVerticalScaleValue() - rect.y); y + designer.getVerticalScaleValue() - rect.y);
return added; return added;
} }
public boolean isAddedIllegal() {
return addedIllegal;
}
public void setAddedIllegal(boolean addedIllegal) {
this.addedIllegal = addedIllegal;
}
} }

5
designer-form/src/main/java/com/fr/design/designer/creator/XChartEditor.java

@ -363,4 +363,9 @@ public class XChartEditor extends XBorderStyleWidgetCreator {
return false; return false;
} }
@Override
public boolean isComponent() {
return true;
}
} }

8
designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java

@ -897,4 +897,12 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo
} }
return ((XCreator) this.getParent()).getLevel() + 1; return ((XCreator) this.getParent()).getLevel() + 1;
} }
/**
* 是否是组件控件还是组件
* @return 是否是组件
*/
public boolean isComponent() {
return false;
}
} }

19
designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java

@ -356,4 +356,23 @@ public class XCreatorUtils {
} }
return null; return null;
} }
/**
* 把控件例如textEditor外层的容器剥掉
* @param xCreator 控件
* @return 内层控件
*/
public static XCreator getXCreatorInnerWidget(XCreator xCreator) {
if (xCreator.acceptType(XWScaleLayout.class)) {
if (xCreator.getComponentCount() > 0 && ((XCreator) xCreator.getComponent(0)).shouldScaleCreator()) {
return (XCreator) xCreator.getComponent(0);
}
}
if (xCreator.acceptType(XWTitleLayout.class)) {
return (XCreator) xCreator.getComponent(0);
}
return xCreator;
}
} }

5
designer-form/src/main/java/com/fr/design/designer/creator/XElementCase.java

@ -365,4 +365,9 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme
public void releaseResources() { public void releaseResources() {
imageLable.setIcon(null); imageLable.setIcon(null);
} }
@Override
public boolean isComponent() {
return true;
}
} }

5
designer-form/src/main/java/com/fr/design/designer/creator/XLayoutContainer.java

@ -586,4 +586,9 @@ public abstract class XLayoutContainer extends XBorderStyleWidgetCreator impleme
public void setDragInAble(boolean dragInAble) { public void setDragInAble(boolean dragInAble) {
this.dragInAble = dragInAble; this.dragInAble = dragInAble;
} }
@Override
public boolean isComponent() {
return true;
}
} }

16
designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java

@ -27,19 +27,16 @@ import com.fr.design.mod.bean.ContentChangeItem;
import com.fr.design.mod.event.TableDataModifyEvent; import com.fr.design.mod.event.TableDataModifyEvent;
import com.fr.design.utils.ComponentUtils; import com.fr.design.utils.ComponentUtils;
import com.fr.event.EventDispatcher; import com.fr.event.EventDispatcher;
import com.fr.form.share.editor.SharableEditorProvider;
import com.fr.form.share.SharableWidgetProvider; import com.fr.form.share.SharableWidgetProvider;
import com.fr.form.share.ShareLoader; import com.fr.form.share.ShareLoader;
import com.fr.form.share.editor.SharableEditorProvider;
import com.fr.form.ui.Widget; import com.fr.form.ui.Widget;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import java.util.Collections;
import java.util.HashMap;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.JWindow; import javax.swing.JWindow;
import java.util.List; import javax.swing.SwingUtilities;
import java.util.Map;
import java.awt.Color; import java.awt.Color;
import java.awt.Component; import java.awt.Component;
import java.awt.Point; import java.awt.Point;
@ -49,7 +46,10 @@ import java.awt.dnd.DropTarget;
import java.awt.dnd.DropTargetDragEvent; import java.awt.dnd.DropTargetDragEvent;
import java.awt.dnd.DropTargetDropEvent; import java.awt.dnd.DropTargetDropEvent;
import java.awt.dnd.DropTargetEvent; import java.awt.dnd.DropTargetEvent;
import javax.swing.SwingUtilities; import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/** /**
* 添加模式下鼠标事件处理器 * 添加模式下鼠标事件处理器
@ -141,7 +141,9 @@ public class FormCreatorDropTarget extends DropTarget {
} }
designer.getSelectionModel().setSelectedCreators( designer.getSelectionModel().setSelectedCreators(
FormSelectionUtils.rebuildSelection(xCreator, new Widget[]{widget})); 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(); tabDragInner.tryDragIn();
} else { } else {
Toolkit.getDefaultToolkit().beep(); Toolkit.getDefaultToolkit().beep();

11
designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormSingleWidgetCardPane.java

@ -113,7 +113,7 @@ public class FormSingleWidgetCardPane extends FormWidgetCardPane {
} }
private void initComponents() { private void initComponents() {
XCreator innerCreator = getXCreatorDedicated(); XCreator innerCreator = XCreatorUtils.getXCreatorInnerWidget(this.xCreator);
attriCardPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); attriCardPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
content.add(attriCardPane, BorderLayout.CENTER); content.add(attriCardPane, BorderLayout.CENTER);
@ -166,7 +166,7 @@ public class FormSingleWidgetCardPane extends FormWidgetCardPane {
private void initDefinePane() { private void initDefinePane() {
currentEditorDefinePane = null; currentEditorDefinePane = null;
XCreator creator = getXCreatorDedicated(); XCreator creator = XCreatorUtils.getXCreatorInnerWidget(this.xCreator);
FormWidgetDefinePaneFactoryBase.RN rn = FormWidgetDefinePaneFactoryBase.createWidgetDefinePane(creator, designer, creator.toData(), new Operator() { FormWidgetDefinePaneFactoryBase.RN rn = FormWidgetDefinePaneFactoryBase.createWidgetDefinePane(creator, designer, creator.toData(), new Operator() {
@Override @Override
public void did(DataCreatorUI ui, String cardName) { public void did(DataCreatorUI ui, String cardName) {
@ -190,11 +190,6 @@ public class FormSingleWidgetCardPane extends FormWidgetCardPane {
currentEditorDefinePane = definePane; currentEditorDefinePane = definePane;
} }
private XCreator getXCreatorDedicated() {
boolean dedicateLayout = xCreator.acceptType(XWScaleLayout.class) && xCreator.getComponentCount() > 0 && ((XCreator) xCreator.getComponent(0)).shouldScaleCreator() || xCreator.acceptType(XWTitleLayout.class);
return dedicateLayout ? (XCreator) xCreator.getComponent(0) : xCreator;
}
@Override @Override
public String title4PopupWindow() { public String title4PopupWindow() {
return "Widget"; return "Widget";
@ -283,7 +278,7 @@ public class FormSingleWidgetCardPane extends FormWidgetCardPane {
} }
public void fireValueChanged() { public void fireValueChanged() {
XCreator creator = getXCreatorDedicated(); XCreator creator = XCreatorUtils.getXCreatorInnerWidget(this.xCreator);
creator.firePropertyChange(); creator.firePropertyChange();
} }

2
designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetAbsoluteBoundPane.java

@ -35,7 +35,7 @@ public class WidgetAbsoluteBoundPane extends WidgetBoundPane {
width.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Coords_And_Size")); width.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Coords_And_Size"));
height.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Coords_And_Size")); height.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Coords_And_Size"));
ratioLockedButton.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Coords_And_Size")); ratioLockedButton.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Coords_And_Size"));
this.add(WidgetBoundsPaneFactory.createAbsoluteBoundsPane(x, y, width, height, ratioLockedButton, WidgetBoundsPaneFactory.NameAttribute.WIDGET)); this.add(WidgetBoundsPaneFactory.createAbsoluteBoundsPane(x, y, width, height, ratioLockedButton, getNameAttribute()));
} }
@Override @Override

15
designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java

@ -89,7 +89,20 @@ public class WidgetBoundPane extends BasicPane {
ratioLockedButton.setLockEnabled(false); ratioLockedButton.setLockEnabled(false);
} }
this.add(WidgetBoundsPaneFactory.createBoundsPane(width, height, ratioLockedButton)); this.add(WidgetBoundsPaneFactory.createBoundsPane(width, height, ratioLockedButton, getNameAttribute()));
}
protected WidgetBoundsPaneFactory.NameAttribute getNameAttribute() {
WidgetBoundsPaneFactory.NameAttribute nameAttribute = WidgetBoundsPaneFactory.NameAttribute.DEFAULT;
if (!isComponent()) {
nameAttribute = WidgetBoundsPaneFactory.NameAttribute.WIDGET;
}
return nameAttribute;
}
protected boolean isComponent() {
XCreator creator = XCreatorUtils.getXCreatorInnerWidget(this.creator);
return creator.isComponent();
} }

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

@ -73,15 +73,13 @@ class FormApp extends AbstractAppProvider {
@Override @Override
public JTemplate<?, ?> call() throws Exception { public JTemplate<?, ?> call() throws Exception {
OpenResult<Form, Parameter[]> result = worker.getResult(); OpenResult<Form, Parameter[]> result = worker.getResult();
return (JTemplate<Form, ?>) StableFactory.getMarkedInstanceObjectFromClass(BaseJForm.XML_TAG, return getJForm(result.getBaseBook(), tplFile, result.getRef());
new Object[]{result.getBaseBook(), tplFile, result.getRef()}, classType, BaseJForm.class);
} }
}); });
worker.start(tplFile.getPath()); worker.start(tplFile.getPath());
OpenResult<Form, Parameter[]> result = worker.getResult(); OpenResult<Form, Parameter[]> result = worker.getResult();
if (result != null) { if (result != null) {
return (JTemplate<Form, ?>) StableFactory.getMarkedInstanceObjectFromClass(BaseJForm.XML_TAG, return getJForm(result.getBaseBook(), tplFile, result.getRef());
new Object[]{result.getBaseBook(), tplFile, new Parameter[0]}, classType, BaseJForm.class);
} }
return emptyForm; return emptyForm;
} else { } else {
@ -90,6 +88,16 @@ class FormApp extends AbstractAppProvider {
} }
} }
@Nullable
private JForm getJForm(Form form, FILE file, Parameter[] parameters) {
try {
return new JForm(form, file, parameters);
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e, e.getMessage());
return null;
}
}
@Nullable @Nullable
private Form getForm(FILE tplFile) { private Form getForm(FILE tplFile) {
ReadXmlTypeLocalManager.setReadXmlType(ReadXmlType.DESIGN); ReadXmlTypeLocalManager.setReadXmlType(ReadXmlType.DESIGN);

31
designer-realize/src/main/java/com/fr/design/share/effect/EffectItemGroup.java

@ -109,15 +109,7 @@ public class EffectItemGroup {
Object value = cellElement.getValue(); Object value = cellElement.getValue();
if (value instanceof ChartCollection) { if (value instanceof ChartCollection) {
ChartCollection chartCollection = (ChartCollection) value; ChartCollection chartCollection = (ChartCollection) value;
for (int index = 0; index < chartCollection.getChartCount(); index++) { initChartEditorByChartCollection(chartCollection, cellSourceNode);
Chart chart= (Chart) chartCollection.getChart(index, ChartProvider.class);
Plot plot = chart.getPlot();
if (plot == null) {
continue;
}
SourceNode chartSourceNode = SourceNodeUtils.createSourceNode(plot, chartCollection.getChartName(index), cellSourceNode);
initChartPlot(plot, chartSourceNode, false);
}
} }
} }
@ -127,16 +119,23 @@ public class EffectItemGroup {
private void initChartEditor() { private void initChartEditor() {
ChartEditor editor = (ChartEditor) this.widget; ChartEditor editor = (ChartEditor) this.widget;
ChartCollection chartCollection = (ChartCollection) editor.getChartCollection(); ChartCollection chartCollection = (ChartCollection) editor.getChartCollection();
initChartEditorByChartCollection(chartCollection, null);
}
private void initChartEditorByChartCollection(ChartCollection chartCollection, SourceNode sourceNode) {
for (int index = 0; index < chartCollection.getChartCount(); index++) { for (int index = 0; index < chartCollection.getChartCount(); index++) {
Chart chart= (Chart) chartCollection.getChart(index, ChartProvider.class); ChartProvider chartProvider = chartCollection.getChart(index, ChartProvider.class);
Plot plot = chart.getPlot(); if (chartProvider instanceof Chart) {
if (plot == null) { Chart chart= (Chart) chartCollection.getChart(index, ChartProvider.class);
continue; Plot plot = chart.getPlot();
if (plot == null) {
continue;
}
SourceNode plotSourceNode = SourceNodeUtils.createSourceNode(plot, chartCollection.getChartName(index), sourceNode);
initChartPlot(plot, plotSourceNode, false);
} }
SourceNode plotSourceNode = SourceNodeUtils.createSourceNode(plot, chartCollection.getChartName(index), null);
initChartPlot(plot, plotSourceNode, false);
} }
} }
private void initChartPlot(Plot plot, SourceNode sourceNode, boolean isSubChart) { private void initChartPlot(Plot plot, SourceNode sourceNode, boolean isSubChart) {

Loading…
Cancel
Save