Browse Source

Merge branch 'release/10.0' of http://cloud.finedevelop.com:2015/scm/~hades/design into release/10.0

bugfix/10.0
Hades 6 years ago
parent
commit
4d6ec1982c
  1. 2
      designer-base/src/main/java/com/fr/design/DesignModelAdapter.java
  2. 1
      designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java
  3. 8
      designer-base/src/main/java/com/fr/design/extra/PluginConstants.java
  4. 7
      designer-base/src/main/java/com/fr/design/extra/WebViewDlgHelper.java
  5. 39
      designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java
  6. 34
      designer-base/src/main/java/com/fr/design/hyperlink/AbstractHyperLinkPane.java
  7. 6
      designer-base/src/main/java/com/fr/design/mainframe/AbstractAppProvider.java
  8. 68
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java
  9. 2
      designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java
  10. 63
      designer-base/src/main/java/com/fr/design/mainframe/JTemplateFactory.java
  11. 25
      designer-base/src/main/java/com/fr/design/parameter/ParaDefinitePane.java
  12. 106
      designer-base/src/main/java/com/fr/file/StashedFILE.java
  13. 48
      designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/impl/ChartHyperRelateCellLinkPane.java
  14. 45
      designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/impl/ChartHyperRelateFloatLinkPane.java
  15. 3
      designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/impl/FormHyperlinkNorthPane.java
  16. 54
      designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/impl/FormHyperlinkPane.java
  17. 2
      designer-chart/src/main/java/com/fr/van/chart/DownloadOnlineSourcesHelper.java
  18. 18
      designer-form/src/main/java/com/fr/design/designer/beans/events/CreatorEventListenerTable.java
  19. 5
      designer-form/src/main/java/com/fr/design/designer/beans/events/DesignerEditListener.java
  20. 46
      designer-form/src/main/java/com/fr/design/form/parameter/FormParaDesigner.java
  21. 343
      designer-form/src/main/java/com/fr/design/mainframe/FormHierarchyTreePane.java
  22. 40
      designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java
  23. 6
      designer-realize/src/main/java/com/fr/design/mainframe/app/DesignerAppActivator.java
  24. 6
      designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java
  25. 9
      designer-realize/src/main/java/com/fr/start/module/DesignerStartup.java

2
designer-base/src/main/java/com/fr/design/DesignModelAdapter.java

@ -134,7 +134,7 @@ public abstract class DesignModelAdapter<T extends BaseBook, S extends JTemplate
*/ */
@Deprecated @Deprecated
public Parameter[] getReportParameters() { public Parameter[] getReportParameters() {
return getTableDataParameters(); return getTemplateParameters();
} }
/** /**

1
designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java

@ -224,6 +224,7 @@ public class EnvChangeEntrance {
@Override @Override
public void doCancel() { public void doCancel() {
envListDialog.dispose(); envListDialog.dispose();
// todo 断开了但是没选择新的环境,那么尝试重连旧环境,等接口
} }
}); });
envListDialog.setVisible(true); envListDialog.setVisible(true);

8
designer-base/src/main/java/com/fr/design/extra/PluginConstants.java

@ -1,14 +1,14 @@
package com.fr.design.extra; package com.fr.design.extra;
import com.fr.stable.StableUtils;
import com.fr.workspace.WorkContext;
/** /**
* Created by ibm on 2017/5/25. * Created by ibm on 2017/5/25.
*/ */
public class PluginConstants { public class PluginConstants {
public static final int BYTES_NUM = 1024; public static final int BYTES_NUM = 1024;
private static final String TEMP_PATH = System.getProperty("user.dir") + "/tmp"; public static final String DOWNLOAD_PATH = StableUtils.pathJoin(WorkContext.getCurrent().getPath() + "/cache");
public static final String DOWNLOAD_PATH = System.getProperty("user.dir") + "/download";
//插件依赖的下载位置
public static final String DEPENDENCE_DOWNLOAD_PATH = System.getProperty("user.dir") + "/download/dependence";
public static final String TEMP_FILE = "temp.zip"; public static final String TEMP_FILE = "temp.zip";
public static final String CONNECTION_404 = "404"; public static final String CONNECTION_404 = "404";

7
designer-base/src/main/java/com/fr/design/extra/WebViewDlgHelper.java

@ -16,6 +16,7 @@ import com.fr.json.JSONObject;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.plugin.PluginStoreConstants; import com.fr.plugin.PluginStoreConstants;
import com.fr.plugin.PluginVerifyException; import com.fr.plugin.PluginVerifyException;
import com.fr.stable.CommonUtils;
import com.fr.stable.EnvChangedListener; import com.fr.stable.EnvChangedListener;
import com.fr.stable.ProductConstants; import com.fr.stable.ProductConstants;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
@ -280,7 +281,11 @@ public class WebViewDlgHelper {
try { try {
if (get()) { if (get()) {
IOUtils.unzip(new File(StableUtils.pathJoin(PluginConstants.DOWNLOAD_PATH, PluginConstants.TEMP_FILE)), installHome); File scriptZip = new File(StableUtils.pathJoin(PluginConstants.DOWNLOAD_PATH, PluginConstants.TEMP_FILE));
if(scriptZip.exists()){
IOUtils.unzip(scriptZip, installHome);
CommonUtils.deleteFile(scriptZip);
}
PluginStoreConstants.refreshProps(); // 下载完刷新一下版本号等 PluginStoreConstants.refreshProps(); // 下载完刷新一下版本号等
JOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Shop_Installed"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"), JOptionPane.INFORMATION_MESSAGE); JOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Shop_Installed"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"), JOptionPane.INFORMATION_MESSAGE);
} }

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

@ -2,7 +2,6 @@ package com.fr.design.file;
import com.fr.base.chart.chartdata.CallbackEvent; import com.fr.base.chart.chartdata.CallbackEvent;
import com.fr.base.io.BaseBook; import com.fr.base.io.BaseBook;
import com.fr.base.io.IOFile;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.base.mode.DesignModeContext; import com.fr.design.base.mode.DesignModeContext;
import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.DesignTableDataManager;
@ -10,17 +9,18 @@ import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.DesignerContext; 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.JTemplateFactory;
import com.fr.design.mainframe.JVirtualTemplate; import com.fr.design.mainframe.JVirtualTemplate;
import com.fr.design.module.DesignModuleFactory; import com.fr.design.module.DesignModuleFactory;
import com.fr.file.FILE; import com.fr.file.FILE;
import com.fr.file.FileNodeFILE; import com.fr.file.FileNodeFILE;
import com.fr.file.StashedFILE;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.CoreConstants; import com.fr.stable.CoreConstants;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.third.org.apache.commons.io.FilenameUtils; import com.fr.third.org.apache.commons.io.FilenameUtils;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
@ -315,7 +315,7 @@ public class HistoryTemplateListCache implements CallbackEvent {
/** /**
* 切换环境时暂存打开的模板内容key 是在历史中的indexvalue 是模板xml 内容byte[] * 切换环境时暂存打开的模板内容key 是在历史中的indexvalue 是模板xml 内容byte[]
*/ */
private Map<Integer, byte[]> bytesMap; private Map<Integer, FILE> stashFILEMap;
/** /**
* 切换环境前将正在编辑的模板暂存起来并且在新环境中重新读取一遍暂存的不是模板文件的内容而是模板对象的内容 * 切换环境前将正在编辑的模板暂存起来并且在新环境中重新读取一遍暂存的不是模板文件的内容而是模板对象的内容
@ -326,20 +326,21 @@ public class HistoryTemplateListCache implements CallbackEvent {
*/ */
public void stash() { public void stash() {
FineLoggerFactory.getLogger().info("Env Change Template Stashing..."); FineLoggerFactory.getLogger().info("Env Change Template Stashing...");
if (bytesMap == null) { if (stashFILEMap == null) {
bytesMap = new HashMap<Integer, byte[]>(); stashFILEMap = new HashMap<Integer, FILE>();
} else { } else {
bytesMap.clear(); stashFILEMap.clear();
} }
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();
try { try {
ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
BaseBook target = template.getTarget(); BaseBook target = template.getTarget();
if (target != null) { if (target != null) {
target.export(outputStream); target.export(outputStream);
bytesMap.put(i, outputStream.toByteArray()); stashFILEMap.put(i, new StashedFILE(file, outputStream.toByteArray()));
} }
// 如果 target == null 那么这个模板是被模板内存优化功能处理过的,不用处理 // 如果 target == null 那么这个模板是被模板内存优化功能处理过的,不用处理
} catch (Exception e) { } catch (Exception e) {
@ -358,27 +359,31 @@ public class HistoryTemplateListCache implements CallbackEvent {
*/ */
public void load() { public void load() {
FineLoggerFactory.getLogger().info("Env Change Template Loading..."); FineLoggerFactory.getLogger().info("Env Change Template Loading...");
if (bytesMap != null && bytesMap.size() != 0) { if (stashFILEMap != null && stashFILEMap.size() != 0) {
int size = historyList.size(); int size = historyList.size();
for (int i = 0; i < size; i++) { for (int i = 0; i < size; i++) {
try { try {
byte[] bytes = bytesMap.get(i); FILE stashedFile = stashFILEMap.get(i);
// 可能有模板 stash 失败的情况,在 load 的时候不更新它 // 可能有模板 stash 失败的情况,在 load 的时候不更新它
if (bytes == null) { // 或者这个模板是被模板内存优化功能处理过的,不用处理
if (stashedFile == null) {
continue; continue;
} }
ByteArrayInputStream inputStream = new ByteArrayInputStream(bytes); JTemplate<?, ?> template = JTemplateFactory.createJTemplate(stashedFile);
BaseBook target = historyList.get(i).getTarget(); if (template != null) {
if (target != null) { historyList.set(i, template);
// todo readStream 这个行为应该上升到 BaseBook 上 // 替换当前正在编辑的模板,使用添加并激活的方式,以便使用统一的入口来处理监听事件
((IOFile) target).readStream(inputStream); if (isCurrentEditingFile(template.getPath())) {
DesignerContext.getDesignerFrame().addAndActivateJTemplate(template);
setCurrentEditingTemplate(template);
FineLoggerFactory.getLogger().info("Env Change Current Editing Template.");
}
} }
// 如果 target == null 那么这个模板是被模板内存优化功能处理过的,不用处理
} catch (Exception e) { } catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
} }
bytesMap.clear(); stashFILEMap.clear();
MutilTempalteTabPane.getInstance().refreshOpenedTemplate(historyList); MutilTempalteTabPane.getInstance().refreshOpenedTemplate(historyList);
MutilTempalteTabPane.getInstance().repaint(); MutilTempalteTabPane.getInstance().repaint();
} }

34
designer-base/src/main/java/com/fr/design/hyperlink/AbstractHyperLinkPane.java

@ -4,9 +4,15 @@ import com.fr.design.beans.FurtherBasicBeanPane;
import com.fr.design.editor.ValueEditorPane; import com.fr.design.editor.ValueEditorPane;
import com.fr.design.editor.ValueEditorPaneFactory; import com.fr.design.editor.ValueEditorPaneFactory;
import com.fr.design.gui.frpane.ReportletParameterViewPane; import com.fr.design.gui.frpane.ReportletParameterViewPane;
import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itableeditorpane.ParameterTableModel; import com.fr.design.gui.itableeditorpane.ParameterTableModel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.js.JavaScript; import com.fr.js.JavaScript;
import com.fr.js.LinkAnimateType;
import javax.swing.JPanel;
import java.util.HashMap; import java.util.HashMap;
/** /**
@ -16,6 +22,7 @@ public abstract class AbstractHyperLinkPane<T> extends FurtherBasicBeanPane<T> {
private HashMap hyperLinkEditorMap; private HashMap hyperLinkEditorMap;
private boolean needRenamePane = false; private boolean needRenamePane = false;
protected ReportletParameterViewPane parameterViewPane; protected ReportletParameterViewPane parameterViewPane;
private UIButtonGroup<LinkAnimateType> animateTypeUIButtonGroup;
public AbstractHyperLinkPane(HashMap hyperLinkEditorMap, boolean needRenamePane) { public AbstractHyperLinkPane(HashMap hyperLinkEditorMap, boolean needRenamePane) {
@ -41,6 +48,33 @@ public abstract class AbstractHyperLinkPane<T> extends FurtherBasicBeanPane<T> {
public void reset() { public void reset() {
} }
protected JPanel createAnimateTypeUIButtonGroup() {
animateTypeUIButtonGroup = new UIButtonGroup<LinkAnimateType>(
new String[]{LinkAnimateType.RELOAD.toLocaleString(), LinkAnimateType.INCREMENT.toLocaleString()},
new LinkAnimateType[]{LinkAnimateType.RELOAD, LinkAnimateType.INCREMENT});
animateTypeUIButtonGroup.setSelectedIndex(0);
JPanel jp = FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane();
jp.add(new UILabel(Toolkit.i18nText("Fine-Design_Chart_Link_Animate_Type")));
jp.add(animateTypeUIButtonGroup);
return jp;
}
protected void populateAnimateType(LinkAnimateType animateType) {
if (animateTypeUIButtonGroup != null && animateType != LinkAnimateType.NONE) {
animateTypeUIButtonGroup.setSelectedItem(animateType);
}
}
protected LinkAnimateType updateAnimateType() {
if (animateTypeUIButtonGroup != null) {
return animateTypeUIButtonGroup.getSelectedItem();
}
return LinkAnimateType.NONE;
}
protected int getChartParaType() { protected int getChartParaType() {
return hyperLinkEditorMap != null ? ParameterTableModel.CHART_NORMAL_USE : ParameterTableModel.NO_CHART_USE; return hyperLinkEditorMap != null ? ParameterTableModel.CHART_NORMAL_USE : ParameterTableModel.NO_CHART_USE;
} }

6
designer-base/src/main/java/com/fr/design/mainframe/AbstractAppProvider.java

@ -8,7 +8,7 @@ import com.fr.stable.fun.mark.API;
* Created by Administrator on 2016/3/17/0017. * Created by Administrator on 2016/3/17/0017.
*/ */
@API(level = App.CURRENT_LEVEL) @API(level = App.CURRENT_LEVEL)
public abstract class AbstractAppProvider<T extends IOFile> extends AbstractProvider implements App{ public abstract class AbstractAppProvider<T extends IOFile> extends AbstractProvider implements App {
public int currentAPILevel() { public int currentAPILevel() {
return CURRENT_LEVEL; return CURRENT_LEVEL;
@ -21,12 +21,12 @@ public abstract class AbstractAppProvider<T extends IOFile> extends AbstractProv
@Override @Override
public void process() { public void process() {
DesignerFrame.registApp(this); JTemplateFactory.register(this);
} }
@Override @Override
public void undo() { public void undo() {
DesignerFrame.removeApp(this); JTemplateFactory.remove(this);
} }
} }

68
designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java

@ -51,7 +51,6 @@ import com.fr.plugin.injectable.PluginModule;
import com.fr.plugin.manage.PluginFilter; import com.fr.plugin.manage.PluginFilter;
import com.fr.plugin.observer.PluginEvent; import com.fr.plugin.observer.PluginEvent;
import com.fr.plugin.observer.PluginEventListener; import com.fr.plugin.observer.PluginEventListener;
import com.fr.stable.CoreConstants;
import com.fr.stable.OperatingSystem; import com.fr.stable.OperatingSystem;
import com.fr.stable.ProductConstants; import com.fr.stable.ProductConstants;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
@ -115,11 +114,9 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
private static final int MENU_HEIGHT = 26; private static final int MENU_HEIGHT = 26;
private static final Integer SECOND_LAYER = new Integer(100); private static final Integer SECOND_LAYER = 100;
private static final Integer TOP_LAYER = new Integer((200)); private static final Integer TOP_LAYER = 200;
private static java.util.List<App<?>> appList = new java.util.ArrayList<App<?>>();
private List<DesignerOpenedListener> designerOpenedListenerList = new ArrayList<>(); private List<DesignerOpenedListener> designerOpenedListenerList = new ArrayList<>();
@ -326,7 +323,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
this.progressDialog = new ProgressDialog(this); this.progressDialog = new ProgressDialog(this);
} }
public void closeAuthorityEditing(){ public void closeAuthorityEditing() {
DesignModeContext.switchTo(com.fr.design.base.mode.DesignerMode.NORMAL); DesignModeContext.switchTo(com.fr.design.base.mode.DesignerMode.NORMAL);
WestRegionContainerPane.getInstance().replaceDownPane( WestRegionContainerPane.getInstance().replaceDownPane(
TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter())); TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()));
@ -342,19 +339,22 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
* 注册app. * 注册app.
* *
* @param app 注册app. * @param app 注册app.
* @deprecated use {@link JTemplateFactory#register(App)} instead
*/ */
@Deprecated
public static void registApp(App<?> app) { public static void registApp(App<?> app) {
JTemplateFactory.register(app);
if (app != null) {
appList.add(app);
}
} }
/**
* 移除app
*
* @param app app
* @deprecated use {@link JTemplateFactory#remove(App)} instead
*/
@Deprecated
public static void removeApp(App<?> app) { public static void removeApp(App<?> app) {
JTemplateFactory.remove(app);
if (app != null) {
appList.remove(app);
}
} }
/** /**
@ -1027,39 +1027,17 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
*/ */
private void openFile(FILE tplFile) { private void openFile(FILE tplFile) {
String fileName = tplFile.getName(); JTemplate jt = JTemplateFactory.createJTemplate(tplFile);
int indexOfLastDot = fileName.lastIndexOf(CoreConstants.DOT); if (jt == null) {
if (indexOfLastDot < 0) {
return; return;
} }
String fileExtention = fileName.substring(indexOfLastDot + 1); // 新的form不往前兼容
for (int i = 0, len = appList.size(); i < len; i++) { if (inValidDesigner(jt)) {
App<?> app = appList.get(i); this.addAndActivateJTemplate();
String[] defaultAppExtentions = app.defaultExtensions(); MutilTempalteTabPane.getInstance().setTemTemplate(
boolean opened = false; HistoryTemplateListPane.getInstance().getCurrentEditingTemplate());
for (int j = 0; j < defaultAppExtentions.length; j++) { } else {
if (defaultAppExtentions[j].equalsIgnoreCase(fileExtention)) { activeTemplate(jt);
// 不要catch
JTemplate jt = app.openTemplate(tplFile);
if (jt == null) {
return;
}
// 新的form不往前兼容
if (inValidDesigner(jt)) {
this.addAndActivateJTemplate();
MutilTempalteTabPane.getInstance().setTemTemplate(
HistoryTemplateListPane.getInstance().getCurrentEditingTemplate());
} else {
activeTemplate(jt);
}
opened = true;
break;
}
}
if (opened) {
break;
}
} }
} }

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

@ -610,7 +610,7 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
} else { } else {
JOptionPane.showMessageDialog( JOptionPane.showMessageDialog(
DesignerContext.getDesignerFrame(), DesignerContext.getDesignerFrame(),
Toolkit.i18nText("Fine-Design_Basic_Template_Status_Locked"), Toolkit.i18nText("Fine-Design-Basic_Save_Failure"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Message"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Message"),
JOptionPane.WARNING_MESSAGE); JOptionPane.WARNING_MESSAGE);
return false; return false;

63
designer-base/src/main/java/com/fr/design/mainframe/JTemplateFactory.java

@ -0,0 +1,63 @@
package com.fr.design.mainframe;
import com.fr.file.FILE;
import com.fr.stable.CoreConstants;
import com.fr.third.javax.annotation.Nonnull;
import com.fr.third.javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.List;
public final class JTemplateFactory {
private static final List<App<?>> ALL_APP = new ArrayList<App<?>>();
private JTemplateFactory() {
}
/**
* 生成设计器编辑模板对象
*
* @param file 包含了模板名称类型以及内容的文件
* @return 设计器编辑的模板对象
*/
@Nullable
public static JTemplate<?, ?> createJTemplate(@Nonnull FILE file) {
String fileName = file.getName();
int indexOfLastDot = fileName.lastIndexOf(CoreConstants.DOT);
if (indexOfLastDot < 0) {
return null;
}
String fileExtension = fileName.substring(indexOfLastDot + 1);
for (App<?> app : ALL_APP) {
String[] defaultAppExtensions = app.defaultExtensions();
for (String defaultAppExtension : defaultAppExtensions) {
if (defaultAppExtension.equalsIgnoreCase(fileExtension)) {
JTemplate<?, ?> jt = app.openTemplate(file);
if (jt != null) {
return jt;
}
}
}
}
return null;
}
/**
* 注册app.
*
* @param app 注册app.
*/
public static void register(App<?> app) {
if (app != null) {
ALL_APP.add(app);
}
}
public static void remove(App<?> app) {
if (app != null) {
ALL_APP.remove(app);
}
}
}

25
designer-base/src/main/java/com/fr/design/parameter/ParaDefinitePane.java

@ -1 +1,24 @@
package com.fr.design.parameter; import com.fr.base.Parameter; public interface ParaDefinitePane { public Parameter[] getNoRepeatParas(Parameter[] paras); public void setParameterArray(Parameter[] ps); public Parameter[] getParameterArray(); public void refreshParameter(); public boolean isWithQueryButton(); public void addingParameter2Editor(Parameter p); public void addingParameter2EditorWithQueryButton(Parameter p); public void addingAllParameter2Editor(); } package com.fr.design.parameter;
import com.fr.base.Parameter;
public interface ParaDefinitePane {
Parameter[] getNoRepeatParas(Parameter[] paras);
void setParameterArray(Parameter[] ps);
Parameter[] getParameterArray();
void refreshParameter();
boolean isWithQueryButton();
void addingParameter2Editor(Parameter p);
void addingParameter2EditorWithQueryButton(Parameter p);
void addingAllParameter2Editor();
}

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

@ -0,0 +1,106 @@
package com.fr.file;
import javax.swing.Icon;
import javax.transaction.NotSupportedException;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.io.OutputStream;
/**
* 切换环境用于暂存的文件类型
*/
public class StashedFILE implements FILE {
private FILE file;
private byte[] content;
public StashedFILE(FILE file, byte[] content) {
this.file = file;
this.content = content;
}
@Override
public String prefix() {
return file.prefix();
}
@Override
public boolean isDirectory() {
return file.isDirectory();
}
@Override
public String getName() {
return file.getName();
}
@Override
public Icon getIcon() {
return file.getIcon();
}
@Override
public String getPath() {
return file.getPath();
}
@Override
public void setPath(String path) {
throw new UnsupportedOperationException();
}
@Override
public FILE getParent() {
throw new UnsupportedOperationException();
}
@Override
public FILE[] listFiles() {
throw new UnsupportedOperationException();
}
@Override
public boolean createFolder(String name) {
throw new UnsupportedOperationException();
}
@Override
public boolean mkfile() throws Exception {
throw new UnsupportedOperationException();
}
@Override
public boolean exists() {
return false;
}
@Override
public void closeTemplate() throws Exception {
// do nothing
}
@Override
public InputStream asInputStream() throws Exception {
return new ByteArrayInputStream(content);
}
@Override
public OutputStream asOutputStream() throws Exception {
throw new NotSupportedException();
}
@Override
public String getEnvFullName() {
return file.getEnvFullName();
}
@Override
public boolean isMemFile() {
return true;
}
@Override
public boolean isEnvFile() {
return false;
}
}

48
designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/impl/ChartHyperRelateCellLinkPane.java

@ -8,12 +8,12 @@ import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.hyperlink.AbstractHyperLinkPane; import com.fr.design.hyperlink.AbstractHyperLinkPane;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.stable.ColumnRow; import com.fr.stable.ColumnRow;
import com.fr.stable.ParameterProvider; import com.fr.stable.ParameterProvider;
import javax.swing.*; import javax.swing.JPanel;
import java.awt.*; import java.awt.BorderLayout;
import java.awt.Dimension;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
@ -53,12 +53,18 @@ public class ChartHyperRelateCellLinkPane extends AbstractHyperLinkPane<ChartHyp
colRowPane = new ColumnRowVerticalPane(); colRowPane = new ColumnRowVerticalPane();
centerPane.add(colRowPane, BorderLayout.NORTH); centerPane.add(colRowPane, BorderLayout.NORTH);
addPaneInCenter(centerPane);
parameterViewPane = new ReportletParameterViewPane(getChartParaType(), getValueEditorPane(), getValueEditorPane()); parameterViewPane = new ReportletParameterViewPane(getChartParaType(), getValueEditorPane(), getValueEditorPane());
parameterViewPane.setBorder(GUICoreUtils.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Parameter"))); parameterViewPane.setBorder(GUICoreUtils.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Parameter")));
parameterViewPane.setPreferredSize(new Dimension(500, 200)); parameterViewPane.setPreferredSize(new Dimension(500, 200));
this.add(parameterViewPane, BorderLayout.SOUTH); this.add(parameterViewPane, BorderLayout.SOUTH);
} }
protected void addPaneInCenter(JPanel centerPane) {
}
@Override @Override
public void populateBean(ChartHyperRelateCellLink ob) { public void populateBean(ChartHyperRelateCellLink ob) {
if (ob == null) { if (ob == null) {
@ -117,9 +123,45 @@ public class ChartHyperRelateCellLinkPane extends AbstractHyperLinkPane<ChartHyp
} }
public static class ChartNoRename extends ChartHyperRelateCellLinkPane { public static class ChartNoRename extends ChartHyperRelateCellLinkPane {
public ChartNoRename() {
super();
}
public ChartNoRename(HashMap hyperLinkEditorMap, boolean needRenamePane) {
super(hyperLinkEditorMap, needRenamePane);
}
protected boolean needRenamePane() { protected boolean needRenamePane() {
return false; return false;
} }
} }
public static class ChartHasAnimateType extends ChartNoRename {
public ChartHasAnimateType() {
super();
}
public ChartHasAnimateType(HashMap hyperLinkEditorMap, boolean needRenamePane) {
super(hyperLinkEditorMap, needRenamePane);
}
@Override
protected void addPaneInCenter(JPanel centerPane) {
centerPane.add(createAnimateTypeUIButtonGroup(), BorderLayout.CENTER);
}
@Override
public void populateBean(ChartHyperRelateCellLink ob) {
super.populateBean(ob);
populateAnimateType(ob.getAnimateType());
}
@Override
public void updateBean(ChartHyperRelateCellLink chartLink) {
super.updateBean(chartLink);
chartLink.setAnimateType(updateAnimateType());
}
}
} }

45
designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/impl/ChartHyperRelateFloatLinkPane.java

@ -11,14 +11,16 @@ import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.hyperlink.AbstractHyperLinkPane; import com.fr.design.hyperlink.AbstractHyperLinkPane;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.stable.ParameterProvider; import com.fr.stable.ParameterProvider;
import javax.swing.*; import javax.swing.JPanel;
import javax.swing.border.Border; import javax.swing.border.Border;
import javax.swing.border.LineBorder; import javax.swing.border.LineBorder;
import javax.swing.border.TitledBorder; import javax.swing.border.TitledBorder;
import java.awt.*; import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
@ -69,6 +71,7 @@ public class ChartHyperRelateFloatLinkPane extends AbstractHyperLinkPane<ChartHy
centerPane.setBorder(border); centerPane.setBorder(border);
centerPane.add(pane, BorderLayout.NORTH); centerPane.add(pane, BorderLayout.NORTH);
addPaneInCenter(centerPane);
parameterViewPane = new ReportletParameterViewPane(getChartParaType(), getValueEditorPane(), getValueEditorPane()); parameterViewPane = new ReportletParameterViewPane(getChartParaType(), getValueEditorPane(), getValueEditorPane());
parameterViewPane.setBorder(GUICoreUtils.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Parameter"))); parameterViewPane.setBorder(GUICoreUtils.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Parameter")));
@ -76,6 +79,9 @@ public class ChartHyperRelateFloatLinkPane extends AbstractHyperLinkPane<ChartHy
this.add(parameterViewPane, BorderLayout.SOUTH); this.add(parameterViewPane, BorderLayout.SOUTH);
} }
protected void addPaneInCenter(JPanel centerPane) {
}
private String[] getFloatNames() { private String[] getFloatNames() {
DesignModelAdapter adapter = DesignModelAdapter.getCurrentModelAdapter(); DesignModelAdapter adapter = DesignModelAdapter.getCurrentModelAdapter();
if (adapter != null) { if (adapter != null) {
@ -148,8 +154,41 @@ public class ChartHyperRelateFloatLinkPane extends AbstractHyperLinkPane<ChartHy
} }
public static class ChartNoRename extends ChartHyperRelateFloatLinkPane { public static class ChartNoRename extends ChartHyperRelateFloatLinkPane {
public ChartNoRename() {
}
public ChartNoRename(HashMap hyperLinkEditorMap, boolean needRenamePane) {
super(hyperLinkEditorMap, needRenamePane);
}
protected boolean needRenamePane() { protected boolean needRenamePane() {
return false; return false;
} }
} }
public static class ChartHasAnimateType extends ChartNoRename {
public ChartHasAnimateType() {
}
public ChartHasAnimateType(HashMap hyperLinkEditorMap, boolean needRenamePane) {
super(hyperLinkEditorMap, needRenamePane);
}
@Override
protected void addPaneInCenter(JPanel centerPane) {
centerPane.add(createAnimateTypeUIButtonGroup(), BorderLayout.CENTER);
}
@Override
public void populateBean(ChartHyperRelateFloatLink ob) {
super.populateBean(ob);
populateAnimateType(ob.getAnimateType());
}
@Override
public void updateBean(ChartHyperRelateFloatLink chartLink) {
super.updateBean(chartLink);
chartLink.setAnimateType(updateAnimateType());
}
}
} }

3
designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/impl/FormHyperlinkNorthPane.java

@ -11,7 +11,6 @@ import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.form.ui.Widget; import com.fr.form.ui.Widget;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.js.FormHyperlinkProvider; import com.fr.js.FormHyperlinkProvider;
import com.fr.stable.bridge.StableFactory; import com.fr.stable.bridge.StableFactory;
@ -51,7 +50,7 @@ public class FormHyperlinkNorthPane extends BasicBeanPane<FormHyperlinkProvider>
targetFrameComboBox = formHyperlinkEditors == null ? new UIComboBox() : new UIComboBox(getFormHyperlinkEditNames()); targetFrameComboBox = formHyperlinkEditors == null ? new UIComboBox() : new UIComboBox(getFormHyperlinkEditNames());
targetFrameComboBox.setRenderer(new DefaultListCellRenderer()); targetFrameComboBox.setRenderer(new DefaultListCellRenderer());
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double[] rowSize = {p, p, p}; double[] rowSize = {p, p};
double[] columnSize = {p, TableLayout.FILL}; double[] columnSize = {p, TableLayout.FILL};
Component[][] components; Component[][] components;
if (!this.needRenamePane) { if (!this.needRenamePane) {

54
designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/impl/FormHyperlinkPane.java

@ -7,13 +7,13 @@ import com.fr.design.hyperlink.AbstractHyperLinkPane;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.form.ui.ElementCaseEditorProvider; import com.fr.form.ui.ElementCaseEditorProvider;
import com.fr.js.FormHyperlinkProvider; import com.fr.js.FormHyperlinkProvider;
import com.fr.stable.ParameterProvider; import com.fr.stable.ParameterProvider;
import com.fr.stable.bridge.StableFactory; import com.fr.stable.bridge.StableFactory;
import javax.swing.*; import javax.swing.BorderFactory;
import java.awt.*; import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.util.HashMap; import java.util.HashMap;
public class FormHyperlinkPane extends AbstractHyperLinkPane<FormHyperlinkProvider> { public class FormHyperlinkPane extends AbstractHyperLinkPane<FormHyperlinkProvider> {
@ -35,13 +35,18 @@ public class FormHyperlinkPane extends AbstractHyperLinkPane<FormHyperlinkProvid
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.setBorder(BorderFactory.createEmptyBorder(BORDER_WIDTH, BORDER_WIDTH, BORDER_WIDTH, BORDER_WIDTH)); this.setBorder(BorderFactory.createEmptyBorder(BORDER_WIDTH, BORDER_WIDTH, BORDER_WIDTH, BORDER_WIDTH));
northPane = new FormHyperlinkNorthPane(needRenamePane()); northPane = new FormHyperlinkNorthPane(needRenamePane());
this.add(northPane, BorderLayout.NORTH);
addNorthPane(northPane);
parameterViewPane = new ReportletParameterViewPane(getChartParaType(), getValueEditorPane(), getValueEditorPane()); parameterViewPane = new ReportletParameterViewPane(getChartParaType(), getValueEditorPane(), getValueEditorPane());
this.add(parameterViewPane, BorderLayout.CENTER); this.add(parameterViewPane, BorderLayout.CENTER);
parameterViewPane.setBorder(GUICoreUtils.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Parameters"), null)); parameterViewPane.setBorder(GUICoreUtils.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Parameters"), null));
} }
protected void addNorthPane(JPanel northPane) {
this.add(northPane, BorderLayout.NORTH);
}
@Override @Override
public String title4PopupWindow() { public String title4PopupWindow() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Hyperlink_Form_Link"); return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Hyperlink_Form_Link");
@ -70,7 +75,6 @@ public class FormHyperlinkPane extends AbstractHyperLinkPane<FormHyperlinkProvid
FormHyperlinkProvider formHyperlink = StableFactory.getMarkedInstanceObjectFromClass(FormHyperlinkProvider.XML_TAG, FormHyperlinkProvider.class); FormHyperlinkProvider formHyperlink = StableFactory.getMarkedInstanceObjectFromClass(FormHyperlinkProvider.XML_TAG, FormHyperlinkProvider.class);
formHyperlink.setType(getHyperlinkType()); formHyperlink.setType(getHyperlinkType());
updateBean(formHyperlink); updateBean(formHyperlink);
return formHyperlink; return formHyperlink;
} }
@ -91,6 +95,13 @@ public class FormHyperlinkPane extends AbstractHyperLinkPane<FormHyperlinkProvid
} }
public static class ChartNoRename extends FormHyperlinkPane { public static class ChartNoRename extends FormHyperlinkPane {
public ChartNoRename(HashMap hyperLinkEditorMap, boolean needRenamePane) {
super(hyperLinkEditorMap, needRenamePane);
}
public ChartNoRename() {
}
protected boolean needRenamePane() { protected boolean needRenamePane() {
return false; return false;
} }
@ -99,4 +110,37 @@ public class FormHyperlinkPane extends AbstractHyperLinkPane<FormHyperlinkProvid
return ParameterTableModel.CHART_NORMAL_USE; return ParameterTableModel.CHART_NORMAL_USE;
} }
} }
public static class ChartHasAnimateType extends ChartNoRename {
public ChartHasAnimateType(HashMap hyperLinkEditorMap, boolean needRenamePane) {
super(hyperLinkEditorMap, needRenamePane);
}
public ChartHasAnimateType() {
}
@Override
protected void addNorthPane(JPanel northPane) {
JPanel panel = new JPanel(new BorderLayout());
panel.add(northPane, BorderLayout.NORTH);
JPanel animatePane = createAnimateTypeUIButtonGroup();
animatePane.setBorder(BorderFactory.createEmptyBorder(0, 8, 10, 10));
panel.add(animatePane, BorderLayout.CENTER);
this.add(panel, BorderLayout.NORTH);
}
@Override
public void populateBean(FormHyperlinkProvider formHyperlink) {
super.populateBean(formHyperlink);
populateAnimateType(formHyperlink.getAnimateType());
}
@Override
public void updateBean(FormHyperlinkProvider formHyperlink) {
super.updateBean(formHyperlink);
formHyperlink.setAnimateType(updateAnimateType());
}
}
} }

2
designer-chart/src/main/java/com/fr/van/chart/DownloadOnlineSourcesHelper.java

@ -10,6 +10,7 @@ import com.fr.general.IOUtils;
import com.fr.general.CloudCenter; import com.fr.general.CloudCenter;
import com.fr.general.http.HttpClient; import com.fr.general.http.HttpClient;
import com.fr.plugin.chart.DownloadSourcesEvent; import com.fr.plugin.chart.DownloadSourcesEvent;
import com.fr.stable.CommonUtils;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
@ -140,6 +141,7 @@ public class DownloadOnlineSourcesHelper implements DownloadSourcesEvent {
if (result) { if (result) {
//安装文件 //安装文件
IOUtils.unZipFilesGBK(temp, StableUtils.pathJoin(WorkContext.getCurrent().getPath(), siteInfo.localDir)); IOUtils.unZipFilesGBK(temp, StableUtils.pathJoin(WorkContext.getCurrent().getPath(), siteInfo.localDir));
CommonUtils.deleteFile(file);
} }
} else { } else {
result = false; result = false;

18
designer-form/src/main/java/com/fr/design/designer/beans/events/CreatorEventListenerTable.java

@ -1,10 +1,11 @@
package com.fr.design.designer.beans.events; package com.fr.design.designer.beans.events;
import java.util.ArrayList;
import com.fr.design.designer.creator.XComponent; import com.fr.design.designer.creator.XComponent;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import javax.swing.SwingUtilities;
import java.util.ArrayList;
public class CreatorEventListenerTable { public class CreatorEventListenerTable {
protected ArrayList<DesignerEditListener> listeners; protected ArrayList<DesignerEditListener> listeners;
@ -18,7 +19,7 @@ public class CreatorEventListenerTable {
return; return;
} }
for (int i = 0; i < listeners.size(); i++) { for (int i = 0; i < listeners.size(); i++) {
if (ComparatorUtils.equals(listener,listeners.get(i))) { if (ComparatorUtils.equals(listener, listeners.get(i))) {
listeners.set(i, listener); listeners.set(i, listener);
return; return;
} }
@ -26,10 +27,15 @@ public class CreatorEventListenerTable {
listeners.add(listener); listeners.add(listener);
} }
private void fireCreatorModified(DesignerEvent evt) { private void fireCreatorModified(final DesignerEvent evt) {
for (int i = 0; i < listeners.size(); i++) { for (int i = 0; i < listeners.size(); i++) {
DesignerEditListener listener = listeners.get(i); final DesignerEditListener listener = listeners.get(i);
listener.fireCreatorModified(evt); SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
listener.fireCreatorModified(evt);
}
});
} }
} }

5
designer-form/src/main/java/com/fr/design/designer/beans/events/DesignerEditListener.java

@ -4,11 +4,12 @@ import java.util.EventListener;
/** /**
* 界面设计组件触发的编辑处理器接口 * 界面设计组件触发的编辑处理器接口
* @since 6.5.4 *
* @author richer * @author richer
* @since 6.5.4
*/ */
public interface DesignerEditListener extends EventListener { public interface DesignerEditListener extends EventListener {
void fireCreatorModified(DesignerEvent evt); void fireCreatorModified(DesignerEvent evt);
} }

46
designer-form/src/main/java/com/fr/design/form/parameter/FormParaDesigner.java

@ -3,21 +3,6 @@
*/ */
package com.fr.design.form.parameter; package com.fr.design.form.parameter;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.Insets;
import java.awt.Rectangle;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import javax.swing.BorderFactory;
import javax.swing.JComponent;
import javax.swing.JPanel;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.Parameter; import com.fr.base.Parameter;
import com.fr.base.parameter.ParameterUI; import com.fr.base.parameter.ParameterUI;
@ -39,7 +24,17 @@ import com.fr.design.designer.creator.XWAbsoluteLayout;
import com.fr.design.designer.creator.XWParameterLayout; import com.fr.design.designer.creator.XWParameterLayout;
import com.fr.design.designer.properties.FormWidgetAuthorityEditPane; import com.fr.design.designer.properties.FormWidgetAuthorityEditPane;
import com.fr.design.form.util.XCreatorConstants; import com.fr.design.form.util.XCreatorConstants;
import com.fr.design.mainframe.*; import com.fr.design.mainframe.AuthorityEditPane;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.EastRegionContainerPane;
import com.fr.design.mainframe.FormArea;
import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.FormDesignerModeForSpecial;
import com.fr.design.mainframe.FormParaPane;
import com.fr.design.mainframe.FormWidgetDetailPane;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.mainframe.WidgetPropertyPane;
import com.fr.design.mainframe.WidgetToolBarPane;
import com.fr.design.parameter.ParaDefinitePane; import com.fr.design.parameter.ParaDefinitePane;
import com.fr.design.parameter.ParameterDesignerProvider; import com.fr.design.parameter.ParameterDesignerProvider;
import com.fr.design.parameter.ParameterPropertyPane; import com.fr.design.parameter.ParameterPropertyPane;
@ -51,9 +46,22 @@ import com.fr.form.ui.WidgetValue;
import com.fr.form.ui.container.WAbsoluteLayout; import com.fr.form.ui.container.WAbsoluteLayout;
import com.fr.form.ui.container.WLayout; import com.fr.form.ui.container.WLayout;
import com.fr.form.ui.container.WParameterLayout; import com.fr.form.ui.container.WParameterLayout;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import javax.swing.BorderFactory;
import javax.swing.JComponent;
import javax.swing.JPanel;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.Insets;
import java.awt.Rectangle;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/** /**
* Created by IntelliJ IDEA. * Created by IntelliJ IDEA.
* User : Richer * User : Richer
@ -169,7 +177,7 @@ public class FormParaDesigner extends FormDesigner implements ParameterDesignerP
this.getEditListenerTable().addListener(new DesignerEditListener() { this.getEditListenerTable().addListener(new DesignerEditListener() {
@Override @Override
public void fireCreatorModified(DesignerEvent evt) { public void fireCreatorModified(final DesignerEvent evt) {
if (evt.getCreatorEventID() != DesignerEvent.CREATOR_SELECTED) { if (evt.getCreatorEventID() != DesignerEvent.CREATOR_SELECTED) {
paraDefinitePane.setParameterArray( paraDefinitePane.setParameterArray(
paraDefinitePane.getNoRepeatParas(DesignModelAdapter.getCurrentModelAdapter().getParameters())); paraDefinitePane.getNoRepeatParas(DesignModelAdapter.getCurrentModelAdapter().getParameters()));
@ -220,7 +228,7 @@ public class FormParaDesigner extends FormDesigner implements ParameterDesignerP
/** /**
* 刷新参数 * 刷新参数
* *
* @param p 参数面板 * @param p 参数面板
* @param jt 当前模版 * @param jt 当前模版
*/ */
public void refreshParameter(ParaDefinitePane p, JTemplate jt) { public void refreshParameter(ParaDefinitePane p, JTemplate jt) {

343
designer-form/src/main/java/com/fr/design/mainframe/FormHierarchyTreePane.java

@ -18,7 +18,6 @@ import com.fr.design.menu.ShortCut;
import com.fr.design.menu.ToolBarDef; import com.fr.design.menu.ToolBarDef;
import com.fr.design.parameter.HierarchyTreePane; import com.fr.design.parameter.HierarchyTreePane;
import javax.swing.Action; import javax.swing.Action;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.Icon; import javax.swing.Icon;
@ -37,112 +36,112 @@ import java.util.ArrayList;
*/ */
public class FormHierarchyTreePane extends FormDockView implements HierarchyTreePane { public class FormHierarchyTreePane extends FormDockView implements HierarchyTreePane {
private static final int NODE_LENGTH = 2; private static final int NODE_LENGTH = 2;
private static final int PARA = 0; private static final int PARA = 0;
private static final int BODY = 1; private static final int BODY = 1;
private static final int SHORTS_SEPARATOR_POS = 4; private static final int SHORTS_SEPARATOR_POS = 4;
private static final int TOOLBAR_PADDING_RIGHT = 10; private static final int TOOLBAR_PADDING_RIGHT = 10;
private ShortCut4JControlPane[] shorts; private ShortCut4JControlPane[] shorts;
private ComponentTree componentTree; private ComponentTree componentTree;
public static FormHierarchyTreePane getInstance() { public static FormHierarchyTreePane getInstance() {
return HOLDER.singleton; return HOLDER.singleton;
} }
public static FormHierarchyTreePane getInstance(FormDesigner editor) { public static FormHierarchyTreePane getInstance(FormDesigner editor) {
HOLDER.singleton.setEditingFormDesigner(editor); HOLDER.singleton.setEditingFormDesigner(editor);
HOLDER.singleton.refreshDockingView(); HOLDER.singleton.refreshDockingView();
return HOLDER.singleton; return HOLDER.singleton;
} }
private static class HOLDER { private static class HOLDER {
private static FormHierarchyTreePane singleton = new FormHierarchyTreePane(); private static FormHierarchyTreePane singleton = new FormHierarchyTreePane();
} }
private FormHierarchyTreePane() { private FormHierarchyTreePane() {
setLayout(new BorderLayout(0, 0)); setLayout(new BorderLayout(0, 0));
} }
@Override @Override
public String getViewTitle() { public String getViewTitle() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Hierarchy_Tree"); return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Hierarchy_Tree");
} }
@Override @Override
public Icon getViewIcon() { public Icon getViewIcon() {
return BaseUtils.readIcon("/com/fr/design/images/m_report/tree.png"); return BaseUtils.readIcon("/com/fr/design/images/m_report/tree.png");
} }
public ComponentTree getComponentTree() { public ComponentTree getComponentTree() {
return componentTree; return componentTree;
} }
/** /**
* 清除 * 清除
*/ */
public void clearDockingView() { public void clearDockingView() {
this.componentTree = null; this.componentTree = null;
} }
@Override @Override
/** /**
* 刷新 * 刷新
*/ */
public void refreshDockingView() { public void refreshDockingView() {
FormDesigner formDesigner = this.getEditingFormDesigner(); FormDesigner formDesigner = this.getEditingFormDesigner();
removeAll(); removeAll();
if(this.componentTree != null) { if (this.componentTree != null) {
this.componentTree.removeAll(); this.componentTree.removeAll();
} }
if (formDesigner == null) { if (formDesigner == null) {
clearDockingView(); clearDockingView();
return; return;
} }
componentTree = new ComponentTree(formDesigner); componentTree = new ComponentTree(formDesigner);
formDesigner.addDesignerEditListener(new DesignerEditListener() { formDesigner.addDesignerEditListener(new DesignerEditListener() {
@Override @Override
public void fireCreatorModified(DesignerEvent evt) { public void fireCreatorModified(DesignerEvent evt) {
refreshComponentTree(); refreshComponentTree();
} }
}); });
ComponentTreeModel treeModel = (ComponentTreeModel) componentTree.getModel(); ComponentTreeModel treeModel = (ComponentTreeModel) componentTree.getModel();
XCreator root = (XCreator)treeModel.getRoot(); XCreator root = (XCreator) treeModel.getRoot();
int childCount = treeModel.getChildCount(root); int childCount = treeModel.getChildCount(root);
//按照节点添加para在下的,但这里需要para节点在上,调整一下位置 //按照节点添加para在下的,但这里需要para节点在上,调整一下位置
if(childCount == NODE_LENGTH){ if (childCount == NODE_LENGTH) {
adjustPosition(treeModel, formDesigner); adjustPosition(treeModel, formDesigner);
} }
add(getWidgetPane(), BorderLayout.CENTER); add(getWidgetPane(), BorderLayout.CENTER);
// 这里要刷新一下,否则控件树中没有任何一个控件处于选中状态 // 这里要刷新一下,否则控件树中没有任何一个控件处于选中状态
refreshComponentTree(); refreshComponentTree();
} }
private void refreshComponentTree() { private void refreshComponentTree() {
componentTree.setAndScrollSelectionPath(componentTree.getSelectedTreePath()); componentTree.setAndScrollSelectionPath(componentTree.getSelectedTreePath());
componentTree.refreshUI(); componentTree.refreshUI();
} }
private JPanel getWidgetPane() { private JPanel getWidgetPane() {
shorts = createShortcuts(); shorts = createShortcuts();
JPanel widgetPane = new JPanel(); JPanel widgetPane = new JPanel();
widgetPane.setLayout(FRGUIPaneFactory.createBorderLayout()); widgetPane.setLayout(FRGUIPaneFactory.createBorderLayout());
widgetPane.add(getToolBarPane(), BorderLayout.CENTER); widgetPane.add(getToolBarPane(), BorderLayout.CENTER);
UIScrollPane scrollPane = new UIScrollPane(componentTree); UIScrollPane scrollPane = new UIScrollPane(componentTree);
scrollPane.setBorder(BorderFactory.createEmptyBorder()); scrollPane.setBorder(BorderFactory.createEmptyBorder());
scrollPane.setPreferredSize(new Dimension(210, 170)); scrollPane.setPreferredSize(new Dimension(210, 170));
widgetPane.add(scrollPane, BorderLayout.SOUTH); widgetPane.add(scrollPane, BorderLayout.SOUTH);
return widgetPane; return widgetPane;
} }
private JPanel getToolBarPane() { private JPanel getToolBarPane() {
UIToolbar toolBar = ToolBarDef.createJToolBar(); UIToolbar toolBar = ToolBarDef.createJToolBar();
toolBar.setUI(new UIToolBarUI(){ toolBar.setUI(new UIToolBarUI() {
@Override @Override
public void paint(Graphics g, JComponent c) { public void paint(Graphics g, JComponent c) {
Graphics2D g2 = (Graphics2D) g; Graphics2D g2 = (Graphics2D) g;
@ -157,80 +156,80 @@ public class FormHierarchyTreePane extends FormDockView implements HierarchyTree
shorts[i].getShortCut().intoJToolBar(toolBar); shorts[i].getShortCut().intoJToolBar(toolBar);
} }
JPanel toolBarPane = new JPanel(new BorderLayout()); JPanel toolBarPane = new JPanel(new BorderLayout());
toolBarPane.add(toolBar, BorderLayout.CENTER); toolBarPane.add(toolBar, BorderLayout.CENTER);
toolBarPane.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, UIConstants.BARNOMAL)); toolBarPane.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, UIConstants.BARNOMAL));
JPanel toolBarPaneWrapper = new JPanel(new BorderLayout()); JPanel toolBarPaneWrapper = new JPanel(new BorderLayout());
toolBarPaneWrapper.add(toolBarPane, BorderLayout.CENTER); toolBarPaneWrapper.add(toolBarPane, BorderLayout.CENTER);
toolBarPaneWrapper.setBorder(BorderFactory.createEmptyBorder(1, 0, 2, TOOLBAR_PADDING_RIGHT)); toolBarPaneWrapper.setBorder(BorderFactory.createEmptyBorder(1, 0, 2, TOOLBAR_PADDING_RIGHT));
return toolBarPaneWrapper; return toolBarPaneWrapper;
} }
protected ShortCut4JControlPane[] createShortcuts() { protected ShortCut4JControlPane[] createShortcuts() {
ArrayList<ShortCut4JControlPane> shortCutList = new ArrayList<>(); ArrayList<ShortCut4JControlPane> shortCutList = new ArrayList<>();
FormDesigner designer = getEditingFormDesigner(); FormDesigner designer = getEditingFormDesigner();
for (Action action : designer.getActions()) { for (Action action : designer.getActions()) {
shortCutList.add(new WidgetEnableShortCut((UndoableAction)action)); shortCutList.add(new WidgetEnableShortCut((UndoableAction) action));
} }
return shortCutList.toArray(new ShortCut4JControlPane[shortCutList.size()]); return shortCutList.toArray(new ShortCut4JControlPane[shortCutList.size()]);
} }
/** /**
* 调整结构树para和body的位置 * 调整结构树para和body的位置
* *
* @param treeModel * @param treeModel
* @param formDesigner * @param formDesigner
*/ */
private void adjustPosition(ComponentTreeModel treeModel,FormDesigner formDesigner){ private void adjustPosition(ComponentTreeModel treeModel, FormDesigner formDesigner) {
XCreator root = (XCreator)treeModel.getRoot(); XCreator root = (XCreator) treeModel.getRoot();
XCreator firstChild = (XCreator)treeModel.getChild(root,PARA); XCreator firstChild = (XCreator) treeModel.getChild(root, PARA);
if(firstChild.acceptType(XWParameterLayout.class)){ if (firstChild.acceptType(XWParameterLayout.class)) {
return; return;
} }
// 绝对布局作为body的时候 // 绝对布局作为body的时候
// 获取第一个子节点的方法中屏蔽了fit // 获取第一个子节点的方法中屏蔽了fit
// 这边另外处理一下 // 这边另外处理一下
else if (firstChild.acceptType(XWAbsoluteBodyLayout.class) && firstChild.getBackupParent() != null) { else if (firstChild.acceptType(XWAbsoluteBodyLayout.class) && firstChild.getBackupParent() != null) {
firstChild = firstChild.getBackupParent(); firstChild = firstChild.getBackupParent();
} }
root.add(firstChild,BODY); root.add(firstChild, BODY);
treeModel.setRoot(root); treeModel.setRoot(root);
componentTree = new ComponentTree(formDesigner,treeModel); componentTree = new ComponentTree(formDesigner, treeModel);
} }
/** /**
* 刷新树 * 刷新树
*/ */
public void refreshRoot() { public void refreshRoot() {
if (componentTree == null) { if (componentTree == null) {
return; return;
} }
componentTree.refreshTreeRoot(); componentTree.refreshTreeRoot();
} }
@Override @Override
/** /**
* 位置 * 位置
* *
* @return 位置 * @return 位置
*/ */
public Location preferredLocation() { public Location preferredLocation() {
return Location.WEST_BELOW; return Location.WEST_BELOW;
} }
private class WidgetEnableShortCut extends ShortCut4JControlPane { private class WidgetEnableShortCut extends ShortCut4JControlPane {
public WidgetEnableShortCut(ShortCut shortCut) { public WidgetEnableShortCut(ShortCut shortCut) {
this.shortCut = shortCut; this.shortCut = shortCut;
} }
/** /**
* 检查是否可用 * 检查是否可用
*/ */
@Override @Override
public void checkEnable() { public void checkEnable() {
this.shortCut.setEnabled(false); this.shortCut.setEnabled(false);
} }
} }
} }

40
designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java

@ -7,18 +7,29 @@ import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.widget.FRWidgetFactory;
import com.fr.form.share.ShareLoader; import com.fr.form.share.ShareLoader;
import com.fr.form.ui.SharableWidgetBindInfo; import com.fr.form.ui.SharableWidgetBindInfo;
import com.fr.log.FineLoggerFactory;
import com.fr.general.CloudCenter; import com.fr.general.CloudCenter;
import com.fr.log.FineLoggerFactory;
import com.fr.share.ShareConstants; import com.fr.share.ShareConstants;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.*; import javax.swing.BorderFactory;
import javax.swing.DefaultComboBoxModel;
import javax.swing.Icon;
import javax.swing.JFileChooser;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.SwingWorker;
import javax.swing.filechooser.FileNameExtensionFilter; import javax.swing.filechooser.FileNameExtensionFilter;
import java.awt.*; import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Desktop;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.awt.event.ItemEvent; import java.awt.event.ItemEvent;
@ -35,27 +46,19 @@ import java.net.URISyntaxException;
* Time: 下午8:18 * Time: 下午8:18
*/ */
public class FormWidgetDetailPane extends FormDockView{ public class FormWidgetDetailPane extends FormDockView{
private static final int LOCAL_WIDGET_LABEL_WIDTH = 90;
private JPanel tabbedPane;
private UIScrollPane downPane; private UIScrollPane downPane;
private JPanel reuWidgetPanel; private JPanel reuWidgetPanel;
private UIComboBox comboBox; private UIComboBox comboBox;
private SharableWidgetBindInfo[] elCaseBindInfoList; private SharableWidgetBindInfo[] elCaseBindInfoList;
private UIButton deleteButton; private UIButton deleteButton;
private UIButton resetButton;
private JPanel editPanel; private JPanel editPanel;
private JPanel resetPanel; private JPanel resetPanel;
private JPanel menutPanel;
private JPanel menutPanelNorthPane; private JPanel menutPanelNorthPane;
private static final int OFFSET_X = 140;
private static final int OFFSET_Y = 26;
private SwingWorker sw; private SwingWorker sw;
//组件面板是否可以编辑 //组件面板是否可以编辑
private boolean isEdit; private boolean isEdit;
private CardLayout card;
private static final String REPORT_TAB = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Engine_Report");
private static final String CHART_TAB = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_ToolBar_Chart");
public static FormWidgetDetailPane getInstance() { public static FormWidgetDetailPane getInstance() {
if (HOLDER.singleton == null) { if (HOLDER.singleton == null) {
@ -135,14 +138,15 @@ public class FormWidgetDetailPane extends FormDockView{
* 初始化菜单栏面板 * 初始化菜单栏面板
*/ */
private void initMenuPanel() { private void initMenuPanel() {
menutPanel = new JPanel(); JPanel menutPanel = new JPanel();
menutPanel.setLayout(FRGUIPaneFactory.createBorderLayout()); menutPanel.setLayout(FRGUIPaneFactory.createBorderLayout());
menutPanel.setBorder(BorderFactory.createEmptyBorder(3, 10, 10, 15)); menutPanel.setBorder(BorderFactory.createEmptyBorder(3, 10, 10, 15));
// menutPanel.setPreferredSize(new Dimension(240, 48));
menutPanelNorthPane = new JPanel(new BorderLayout()); menutPanelNorthPane = new JPanel(new BorderLayout());
menutPanelNorthPane.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Local_Widget"), UILabel localWidgetLabel = FRWidgetFactory.createLineWrapLabel(
SwingConstants.HORIZONTAL), BorderLayout.WEST); com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Local_Widget"),
LOCAL_WIDGET_LABEL_WIDTH);
menutPanelNorthPane.add(localWidgetLabel, BorderLayout.WEST);
menutPanelNorthPane.add(initEditButtonPane(), BorderLayout.EAST); menutPanelNorthPane.add(initEditButtonPane(), BorderLayout.EAST);
menutPanelNorthPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 0)); menutPanelNorthPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 0));
@ -174,7 +178,7 @@ public class FormWidgetDetailPane extends FormDockView{
*/ */
private JPanel initResetButtonPane() { private JPanel initResetButtonPane() {
resetPanel = new JPanel(); resetPanel = new JPanel();
resetButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Reset")); UIButton resetButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Reset"));
resetPanel.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2)); resetPanel.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
resetButton.setBackground(Color.white); resetButton.setBackground(Color.white);
resetButton.setForeground(new Color(0x333334)); resetButton.setForeground(new Color(0x333334));

6
designer-realize/src/main/java/com/fr/design/mainframe/app/DesignerAppActivator.java

@ -1,7 +1,7 @@
package com.fr.design.mainframe.app; package com.fr.design.mainframe.app;
import com.fr.design.mainframe.App; import com.fr.design.mainframe.App;
import com.fr.design.mainframe.DesignerFrame; import com.fr.design.mainframe.JTemplateFactory;
import com.fr.module.Activator; import com.fr.module.Activator;
import com.fr.module.extension.Prepare; import com.fr.module.extension.Prepare;
@ -17,7 +17,7 @@ public class DesignerAppActivator extends Activator implements Prepare {
List<App> appList = rightCollectMutable(App.KEY); List<App> appList = rightCollectMutable(App.KEY);
for (App app : appList) { for (App app : appList) {
DesignerFrame.registApp(app); JTemplateFactory.register(app);
} }
} }
@ -26,7 +26,7 @@ public class DesignerAppActivator extends Activator implements Prepare {
List<App> appList = rightCollectMutable(App.KEY); List<App> appList = rightCollectMutable(App.KEY);
for (App app : appList) { for (App app : appList) {
DesignerFrame.removeApp(app); JTemplateFactory.remove(app);
} }
} }

6
designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java

@ -82,6 +82,10 @@ public class DesignerSocketIO {
socketIO.get().on(Socket.EVENT_DISCONNECT, new Emitter.Listener() { socketIO.get().on(Socket.EVENT_DISCONNECT, new Emitter.Listener() {
@Override @Override
public void call(Object... objects) { public void call(Object... objects) {
/*
* todo 远程心跳断开不一定 socketio 断开 和远程紧密相关的业务都绑定在心跳上切换成心跳断开之后进行提醒
* socketio 只用推日志和通知配置变更
*/
if (status != Status.Disconnecting) { if (status != Status.Disconnecting) {
try { try {
SwingUtilities.invokeAndWait(new Runnable() { SwingUtilities.invokeAndWait(new Runnable() {
@ -114,7 +118,7 @@ public class DesignerSocketIO {
Integer[] ports = WorkContext.getCurrent().get(SocketInfoOperator.class).getPort(); Integer[] ports = WorkContext.getCurrent().get(SocketInfoOperator.class).getPort();
WorkspaceConnection connection = WorkContext.getCurrent().getConnection(); WorkspaceConnection connection = WorkContext.getCurrent().getConnection();
String[] result = new String[ports.length]; String[] result = new String[ports.length];
for (int i = 0; i < ports.length; i++ ) { for (int i = 0; i < ports.length; i++) {
result[i] = String.format("%s://%s:%s%s?%s=%s&%s=%s", result[i] = String.format("%s://%s:%s%s?%s=%s&%s=%s",
url.getProtocol(), url.getProtocol(),
url.getHost(), url.getHost(),

9
designer-realize/src/main/java/com/fr/start/module/DesignerStartup.java

@ -82,16 +82,15 @@ public class DesignerStartup extends Activator {
*/ */
private void registerEnvListener() { private void registerEnvListener() {
/*切换环境前,关闭所有相关模块,最后执行*/
/*切换环境前,关闭所有相关模块*/ listenEvent(WorkspaceEvent.BeforeSwitch, new Listener<Workspace>(Integer.MIN_VALUE) {
listenEvent(WorkspaceEvent.BeforeSwitch, new Listener<Workspace>() {
@Override @Override
public void on(Event event, Workspace current) { public void on(Event event, Workspace current) {
getSub(EnvBasedModule.class).stop(); getSub(EnvBasedModule.class).stop();
} }
}); });
/*切换环境后,重新启动所有相关模块*/ /*切换环境后,重新启动所有相关模块,最先执行*/
listenEvent(WorkspaceEvent.AfterSwitch, new Listener<Workspace>(Integer.MAX_VALUE) { listenEvent(WorkspaceEvent.AfterSwitch, new Listener<Workspace>(Integer.MAX_VALUE) {
@Override @Override
@ -110,7 +109,7 @@ public class DesignerStartup extends Activator {
} }
} }
}); });
/*切换环境前,存储一下打开的所有文件对象,优先级高于默认优先级,要先于 关闭相关模块部分 被触发*/ /*切换环境前,存储一下打开的所有文件对象,要先于 关闭相关模块部分 被触发*/
listenEvent(WorkspaceEvent.BeforeSwitch, new Listener<Workspace>(Integer.MAX_VALUE) { listenEvent(WorkspaceEvent.BeforeSwitch, new Listener<Workspace>(Integer.MAX_VALUE) {
@Override @Override
public void on(Event event, Workspace workspace) { public void on(Event event, Workspace workspace) {

Loading…
Cancel
Save