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));
}
void onGetFocus() {
consumeTimer.start();
}
@ -1262,6 +1262,14 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
template.setTemplateID(templateId);
}
public void addWidgetProcessInfo(Widget widget) {
}
public void removeWidgetProcessInfo(Widget widget) {
}
public abstract String route();
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.chart.chartattr.ChartCollection;
import com.fr.chartx.attr.ChartProvider;
import com.fr.form.ui.Widget;
import com.fr.json.JSONArray;
/**
@ -45,7 +46,12 @@ public abstract class TemplateProcessInfo<T extends BaseBook> {
//获取组件信息
public abstract JSONArray getComponentsInfo();
public void addComponentCreateInfo(Widget widget) {
}
public void addComponentRemoveInfo(Widget widget) {
}
protected boolean isTestCell(Object value, Style style) {
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.mainframe.FormDesigner;
import com.fr.design.mainframe.JForm;
import com.fr.design.mainframe.JTemplate;
import com.fr.form.ui.Widget;
import com.fr.form.ui.container.WFitLayout;
import java.util.UUID;
public class FormDesignerUtils {
/**
@ -34,17 +32,12 @@ public class FormDesignerUtils {
public static void addWidgetProcessInfo(Widget widget) {
JTemplate jTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
if (jTemplate instanceof JForm) {
widget.setWidgetID(UUID.randomUUID().toString());
((JForm) jTemplate).addWidgetProcessInfo(widget);
}
jTemplate.addWidgetProcessInfo(widget);
}
public static void removeWidgetProcessInfo(Widget widget) {
JTemplate jTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
if (jTemplate instanceof JForm) {
((JForm) jTemplate).removeWidgetProcessInfo(widget);
}
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.List;
import java.util.Set;
import java.util.UUID;
public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm<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) {
return;
}
((JFormProcessInfo) processInfo).addComponentCreateInfo(widget);
widget.setWidgetID(UUID.randomUUID().toString());
processInfo.addComponentCreateInfo(widget);
}
public void removeWidgetProcessInfo(Widget widget) {
if (processInfo == null) {
return;
}
((JFormProcessInfo) processInfo).addComponentRemoveInfo(widget);
processInfo.addComponentRemoveInfo(widget);
}
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 {
Chart,
Report,
Widget,
TabLayout,
Absolute;
Chart {
@Override
protected boolean acceptType(Widget widget) {
return widget.acceptType(ChartEditor.class);
}
},
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) {
if (widget.acceptType(ChartEditor.class)) {
return Chart;
} else if (widget.acceptType(ElementCaseEditor.class)) {
return Report;
} else if (widget.acceptType(WCardLayout.class)) {
return TabLayout;
} else if (widget.acceptType(WAbsoluteLayout.class)) {
return Absolute;
} else {
return Widget;
for (ComponentType componentType : values()) {
if (componentType.acceptType(widget)) {
return componentType;
}
}
return Widget;
}
}
}

Loading…
Cancel
Save