Browse Source

代码修改

feature/big-screen
kerry 5 years ago
parent
commit
901faae84c
  1. 10
      designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java
  2. 6
      designer-base/src/main/java/com/fr/design/mainframe/template/info/TemplateProcessInfo.java
  3. 11
      designer-form/src/main/java/com/fr/design/form/util/FormDesignerUtils.java
  4. 6
      designer-form/src/main/java/com/fr/design/mainframe/JForm.java
  5. 52
      designer-form/src/main/java/com/fr/design/mainframe/template/info/ComponentProcessInfo.java

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

@ -130,7 +130,7 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
consumeTimer.setEnabled(shouldInitForCollectInfo(isNewFile)); consumeTimer.setEnabled(shouldInitForCollectInfo(isNewFile));
} }
void onGetFocus() { void onGetFocus() {
consumeTimer.start(); consumeTimer.start();
} }
@ -1262,6 +1262,14 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
template.setTemplateID(templateId); template.setTemplateID(templateId);
} }
public void addWidgetProcessInfo(Widget widget) {
}
public void removeWidgetProcessInfo(Widget widget) {
}
public abstract String route(); public abstract String route();
public String getTemplateName() { public String getTemplateName() {

6
designer-base/src/main/java/com/fr/design/mainframe/template/info/TemplateProcessInfo.java

@ -4,6 +4,7 @@ import com.fr.base.Style;
import com.fr.base.io.BaseBook; import com.fr.base.io.BaseBook;
import com.fr.chart.chartattr.ChartCollection; import com.fr.chart.chartattr.ChartCollection;
import com.fr.chartx.attr.ChartProvider; import com.fr.chartx.attr.ChartProvider;
import com.fr.form.ui.Widget;
import com.fr.json.JSONArray; import com.fr.json.JSONArray;
/** /**
@ -45,7 +46,12 @@ public abstract class TemplateProcessInfo<T extends BaseBook> {
//获取组件信息 //获取组件信息
public abstract JSONArray getComponentsInfo(); public abstract JSONArray getComponentsInfo();
public void addComponentCreateInfo(Widget widget) {
}
public void addComponentRemoveInfo(Widget widget) {
}
protected boolean isTestCell(Object value, Style style) { protected boolean isTestCell(Object value, Style style) {
if (value instanceof ChartCollection && isTestChartCollection((ChartCollection) value)) { if (value instanceof ChartCollection && isTestChartCollection((ChartCollection) value)) {

11
designer-form/src/main/java/com/fr/design/form/util/FormDesignerUtils.java

@ -2,12 +2,10 @@ package com.fr.design.form.util;
import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.JForm;
import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplate;
import com.fr.form.ui.Widget; import com.fr.form.ui.Widget;
import com.fr.form.ui.container.WFitLayout; import com.fr.form.ui.container.WFitLayout;
import java.util.UUID;
public class FormDesignerUtils { public class FormDesignerUtils {
/** /**
@ -34,17 +32,12 @@ public class FormDesignerUtils {
public static void addWidgetProcessInfo(Widget widget) { public static void addWidgetProcessInfo(Widget widget) {
JTemplate jTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); JTemplate jTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
if (jTemplate instanceof JForm) { jTemplate.addWidgetProcessInfo(widget);
widget.setWidgetID(UUID.randomUUID().toString());
((JForm) jTemplate).addWidgetProcessInfo(widget);
}
} }
public static void removeWidgetProcessInfo(Widget widget) { public static void removeWidgetProcessInfo(Widget widget) {
JTemplate jTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); JTemplate jTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
if (jTemplate instanceof JForm) { jTemplate.removeWidgetProcessInfo(widget);
((JForm) jTemplate).removeWidgetProcessInfo(widget);
}
} }
} }

6
designer-form/src/main/java/com/fr/design/mainframe/JForm.java

@ -105,6 +105,7 @@ import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import java.util.UUID;
public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm<Form> { public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm<Form> {
private static final String FORM_CARD = "FORM"; private static final String FORM_CARD = "FORM";
@ -223,14 +224,15 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm<F
if (processInfo == null) { if (processInfo == null) {
return; return;
} }
((JFormProcessInfo) processInfo).addComponentCreateInfo(widget); widget.setWidgetID(UUID.randomUUID().toString());
processInfo.addComponentCreateInfo(widget);
} }
public void removeWidgetProcessInfo(Widget widget) { public void removeWidgetProcessInfo(Widget widget) {
if (processInfo == null) { if (processInfo == null) {
return; return;
} }
((JFormProcessInfo) processInfo).addComponentRemoveInfo(widget); processInfo.addComponentRemoveInfo(widget);
} }
public FormECCompositeProvider getReportComposite() { public FormECCompositeProvider getReportComposite() {

52
designer-form/src/main/java/com/fr/design/mainframe/template/info/ComponentProcessInfo.java

@ -50,24 +50,46 @@ public class ComponentProcessInfo {
} }
enum ComponentType { enum ComponentType {
Chart, Chart {
Report, @Override
Widget, protected boolean acceptType(Widget widget) {
TabLayout, return widget.acceptType(ChartEditor.class);
Absolute; }
},
Report {
@Override
protected boolean acceptType(Widget widget) {
return widget.acceptType(ElementCaseEditor.class);
}
},
Widget {
@Override
protected boolean acceptType(Widget widget) {
return false;
}
},
TabLayout {
@Override
protected boolean acceptType(Widget widget) {
return widget.acceptType(WCardLayout.class);
}
},
Absolute {
@Override
protected boolean acceptType(Widget widget) {
return widget.acceptType(WAbsoluteLayout.class);
}
};
protected abstract boolean acceptType(Widget widget);
public static ComponentType parseType(Widget widget) { public static ComponentType parseType(Widget widget) {
if (widget.acceptType(ChartEditor.class)) { for (ComponentType componentType : values()) {
return Chart; if (componentType.acceptType(widget)) {
} else if (widget.acceptType(ElementCaseEditor.class)) { return componentType;
return Report; }
} else if (widget.acceptType(WCardLayout.class)) {
return TabLayout;
} else if (widget.acceptType(WAbsoluteLayout.class)) {
return Absolute;
} else {
return Widget;
} }
return Widget;
} }
} }
} }

Loading…
Cancel
Save