Browse Source

REPORT-58525 解决pr中的问题

research/11.0
方磊 3 years ago
parent
commit
df1bfa9478
  1. 41
      designer-form/src/main/java/com/fr/design/designer/beans/models/NewFormModel.java
  2. 17
      designer-form/src/main/java/com/fr/design/mainframe/JForm.java
  3. 3
      designer-form/src/main/java/com/fr/design/widget/ui/designer/EmptyLayoutPane.java
  4. 16
      designer-form/src/main/java/com/fr/design/widget/ui/designer/NewFormPane.java
  5. 12
      designer-form/src/main/resources/com/fr/design/form/layouts/config.json
  6. 79
      designer-form/src/main/resources/com/fr/design/form/layouts/templates/empty.frm
  7. 0
      designer-form/src/main/resources/com/fr/design/form/layouts/templates/multi/1.frm
  8. 0
      designer-form/src/main/resources/com/fr/design/form/layouts/templates/multi/2.frm
  9. 0
      designer-form/src/main/resources/com/fr/design/form/layouts/templates/multi/3.frm
  10. 0
      designer-form/src/main/resources/com/fr/design/form/layouts/templates/multi/4.frm
  11. 0
      designer-form/src/main/resources/com/fr/design/form/layouts/templates/multi/5.frm
  12. 0
      designer-form/src/main/resources/com/fr/design/form/layouts/templates/multi/6.frm

41
designer-form/src/main/java/com/fr/design/designer/beans/models/NewFormModel.java

@ -6,12 +6,7 @@ import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils;
import com.fr.third.fasterxml.jackson.databind.ObjectMapper;
import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.io.Serializable;
import java.util.HashMap;
import java.util.List;
@ -19,7 +14,6 @@ import java.util.Map;
public class NewFormModel implements Serializable {
private static final String CONFIG_FILE_PATH = "/com/fr/design/form/layouts/config.json";
private static final String CHARSET_DEFAULT = "utf-8";
private static NewFormModel holder = null;
private Map<String, List<PredefinedLayout>> config = new HashMap<>();
@ -39,49 +33,20 @@ public class NewFormModel implements Serializable {
}
private static String readConfigFile() {
private synchronized static String readConfigFile() {
String result = StringUtils.EMPTY;
InputStreamReader isReader = null;
InputStream is = null;
try {
is = IOUtils.readResource(CONFIG_FILE_PATH);
isReader = new InputStreamReader(is, CHARSET_DEFAULT);
result = readString(isReader);
result = IOUtils.inputStream2String(is);
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
} finally {
close(is);
close(isReader);
IOUtils.close(is);
}
return result;
}
private static String readString(Reader reader) throws Exception {
StringBuilder builder = new StringBuilder();
final BufferedReader bufferedReader = new BufferedReader(reader);
String line;
while ((line = bufferedReader.readLine()) != null) {
builder.append(line);
}
bufferedReader.close();
line = builder.toString();
builder = null;
return line;
}
private static void close(Closeable closeable) {
if (closeable == null) {
return;
}
try {
closeable.close();
} catch (IOException ignore) {
}
}
public Map<String, List<PredefinedLayout>> getConfig() {
return config;
}

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

@ -6,12 +6,13 @@ import com.fr.base.Parameter;
import com.fr.base.Releasable;
import com.fr.base.extension.FileExtension;
import com.fr.base.iofile.attr.ExtendSharableAttrMark;
import com.fr.base.theme.TemplateThemeCompatible;
import com.fr.base.vcs.DesignerMode;
import com.fr.base.iofile.attr.TemplateLayoutIdAttrMark;
import com.fr.base.theme.FormTheme;
import com.fr.base.theme.FormThemeConfig;
import com.fr.base.theme.TemplateTheme;
import com.fr.base.theme.TemplateThemeCompatible;
import com.fr.base.theme.TemplateThemeConfig;
import com.fr.base.vcs.DesignerMode;
import com.fr.design.DesignModelAdapter;
import com.fr.design.DesignState;
import com.fr.design.ExtraDesignClassManager;
@ -23,10 +24,6 @@ import com.fr.design.base.mode.DesignModeContext;
import com.fr.design.cell.FloatElementsProvider;
import com.fr.design.data.datapane.TableDataTreePane;
import com.fr.design.designer.TargetComponent;
import com.fr.design.designer.beans.actions.CopyAction;
import com.fr.design.designer.beans.actions.CutAction;
import com.fr.design.designer.beans.actions.FormDeleteAction;
import com.fr.design.designer.beans.actions.PasteAction;
import com.fr.design.designer.beans.events.DesignerEditListener;
import com.fr.design.designer.beans.events.DesignerEvent;
import com.fr.design.designer.creator.XComponent;
@ -120,6 +117,7 @@ import java.util.List;
public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm<Form>, Releasable {
private static final String FORM_CARD = "FORM";
private static final String ELEMENTCASE_CARD = "ELEMENTCASE";
private static final String EMPTY_FORM_LAYOUTID = "9ebf6aff-ad53-45a9-a175-9633f4162a3a";
private static final String[] CARDNAME = new String[]{FORM_CARD, ELEMENTCASE_CARD};
private static final int TOOLBARPANEDIMHEIGHT_FORM = 60;
@ -141,6 +139,7 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm<F
public JForm() {
super(new Form(new WBorderLayout("form")), "Form");
initEmptyFormLayoutId();
}
public JForm(Form form) {
@ -155,6 +154,12 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm<F
super(form, file);
}
private void initEmptyFormLayoutId() {
Form form = this.getTarget();
form.addAttrMark(new TemplateLayoutIdAttrMark(EMPTY_FORM_LAYOUTID));
form.setLayoutId(EMPTY_FORM_LAYOUTID);
}
@Override
protected void addPane(PropertyItemPaneProvider provider) {

3
designer-form/src/main/java/com/fr/design/widget/ui/designer/EmptyLayoutPane.java

@ -3,6 +3,7 @@ package com.fr.design.widget.ui.designer;
import com.fr.base.svg.IconUtils;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.stable.StringUtils;
import javax.swing.BorderFactory;
import java.awt.BorderLayout;
@ -30,6 +31,6 @@ public class EmptyLayoutPane extends PredefinedLayoutPane {
@Override
public String getTemplatePath() {
return "/com/fr/design/form/layouts/templates/empty.frm";
return StringUtils.EMPTY;
}
}

16
designer-form/src/main/java/com/fr/design/widget/ui/designer/NewFormPane.java

@ -11,11 +11,15 @@ import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.BaseJForm;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.form.main.Form;
import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils;
import com.fr.stable.bridge.StableFactory;
import javax.swing.BorderFactory;
import javax.swing.DefaultListCellRenderer;
@ -250,16 +254,26 @@ public class NewFormPane extends BasicPane {
}
private void newForm(String path) {
if (StringUtils.isEmpty(path)) {
newEmptyForm();
return;
}
try {
Form form = new Form();
form.readStream(NewFormPane.class.getResourceAsStream(path));
NewJForm newJForm = new NewJForm(form);
DesignerContext.getDesignerFrame().addAndActivateJTemplate((newJForm));
DesignerContext.getDesignerFrame().addAndActivateJTemplate(newJForm);
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
private void newEmptyForm() {
BaseJForm jform = StableFactory.getMarkedInstanceObjectFromClass(BaseJForm.XML_TAG, BaseJForm.class);
DesignerContext.getDesignerFrame().addAndActivateJTemplate((JTemplate<?, ?>) jform);
}
private void setSelectedLayoutPane(PredefinedLayoutPane layoutPane) {
if (selectedLayoutPane != layoutPane) {
if (selectedLayoutPane != null) {

12
designer-form/src/main/resources/com/fr/design/form/layouts/config.json

@ -66,32 +66,32 @@
],
"多模块":[
{
"template":"多模块/1.frm",
"template":"multi/1.frm",
"realStyle":"real_style_13",
"simpleStyle":"simple_style_13"
},
{
"template":"多模块/2.frm",
"template":"multi/2.frm",
"realStyle":"real_style_14",
"simpleStyle":"simple_style_14"
},
{
"template":"多模块/3.frm",
"template":"multi/3.frm",
"realStyle":"real_style_15",
"simpleStyle":"simple_style_15"
},
{
"template":"多模块/4.frm",
"template":"multi/4.frm",
"realStyle":"real_style_16",
"simpleStyle":"simple_style_16"
},
{
"template":"多模块/5.frm",
"template":"multi/5.frm",
"realStyle":"real_style_17",
"simpleStyle":"simple_style_17"
},
{
"template":"多模块/6.frm",
"template":"multi/6.frm",
"realStyle":"real_style_18",
"simpleStyle":"simple_style_18"
}

79
designer-form/src/main/resources/com/fr/design/form/layouts/templates/empty.frm

@ -1,79 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<Form xmlVersion="20170720" releaseVersion="11.0.0">
<FormMobileAttr>
<FormMobileAttr refresh="false" isUseHTML="false" isMobileOnly="false" isAdaptivePropertyAutoMatch="false" appearRefresh="false" promptWhenLeaveWithoutSubmit="false" allowDoubleClickOrZoom="true"/>
</FormMobileAttr>
<Parameters/>
<Layout class="com.fr.form.ui.container.WBorderLayout">
<WidgetName name="form"/>
<WidgetAttr aspectRatioLocked="false" aspectRatioBackup="-1.0" description="">
<MobileBookMark useBookMark="false" bookMarkName="" frozen="false"/>
<PrivilegeControl/>
</WidgetAttr>
<FollowingTheme borderStyle="false"/>
<Margin top="0" left="0" bottom="0" right="0"/>
<Border>
<border style="0" borderRadius="0" type="0" borderStyle="0">
<color>
<FineColor color="-723724" hor="-1" ver="-1"/>
</color>
</border>
<WidgetTitle>
<O>
<![CDATA[新建标题]]></O>
<FRFont name="Hiragino Sans GB" style="0" size="72"/>
<Position pos="0"/>
</WidgetTitle>
<Alpha alpha="1.0"/>
</Border>
<LCAttr vgap="0" hgap="0" compInterval="0"/>
<ShowBookmarks showBookmarks="false"/>
<Center class="com.fr.form.ui.container.WFitLayout">
<WidgetName name="body"/>
<WidgetAttr aspectRatioLocked="false" aspectRatioBackup="-1.0" description="">
<MobileBookMark useBookMark="false" bookMarkName="" frozen="false"/>
<PrivilegeControl/>
</WidgetAttr>
<FollowingTheme borderStyle="true"/>
<Margin top="0" left="0" bottom="0" right="0"/>
<Border>
<border style="0" borderRadius="0" type="0" borderStyle="0">
<color>
<FineColor color="-723724" hor="-1" ver="-1"/>
</color>
</border>
<WidgetTitle>
<O>
<![CDATA[新建标题]]></O>
<FRFont name="Hiragino Sans GB" style="0" size="72"/>
<Position pos="0"/>
</WidgetTitle>
<Background name="ColorBackground">
<color>
<FineColor color="-1" hor="-1" ver="-1"/>
</color>
</Background>
<Alpha alpha="1.0"/>
</Border>
<LCAttr vgap="0" hgap="0" compInterval="0"/>
<ShowBookmarks showBookmarks="true"/>
<Sorted sorted="false"/>
<MobileWidgetList/>
<FrozenWidgets/>
<MobileBookMarkStyle class="com.fr.form.ui.mobile.impl.DefaultMobileBookMarkStyle"/>
<WidgetZoomAttr compState="0"/>
<AppRelayout appRelayout="true"/>
<Size width="960" height="540"/>
<ResolutionScalingAttr percent="1.0"/>
<BodyLayoutType type="0"/>
</Center>
</Layout>
<DesignerVersion DesignerVersion="LAA"/>
<PreviewType PreviewType="6"/>
<TemplateLayoutIdAttrMark class="com.fr.base.iofile.attr.TemplateLayoutIdAttrMark">
<TemplateLayoutIdAttrMark LayoutId="9ebf6aff-ad53-45a9-a175-9633f4162a3a"/>
</TemplateLayoutIdAttrMark>
<NewFormMarkAttr class="com.fr.form.fit.NewFormMarkAttr">
<NewFormMarkAttr type="1" tabPreload="true" bodyHeight="540" bodyWidth="960"/>
</NewFormMarkAttr>
</Form>

0
designer-form/src/main/resources/com/fr/design/form/layouts/templates/多模块/1.frm → designer-form/src/main/resources/com/fr/design/form/layouts/templates/multi/1.frm

0
designer-form/src/main/resources/com/fr/design/form/layouts/templates/多模块/2.frm → designer-form/src/main/resources/com/fr/design/form/layouts/templates/multi/2.frm

0
designer-form/src/main/resources/com/fr/design/form/layouts/templates/多模块/3.frm → designer-form/src/main/resources/com/fr/design/form/layouts/templates/multi/3.frm

0
designer-form/src/main/resources/com/fr/design/form/layouts/templates/多模块/4.frm → designer-form/src/main/resources/com/fr/design/form/layouts/templates/multi/4.frm

0
designer-form/src/main/resources/com/fr/design/form/layouts/templates/多模块/5.frm → designer-form/src/main/resources/com/fr/design/form/layouts/templates/multi/5.frm

0
designer-form/src/main/resources/com/fr/design/form/layouts/templates/多模块/6.frm → designer-form/src/main/resources/com/fr/design/form/layouts/templates/multi/6.frm

Loading…
Cancel
Save