Browse Source

无JIRA任务 设计器预览修改为符合新的规范

master
richie 7 years ago
parent
commit
754a5ecf24
  1. 22
      designer-base/src/com/fr/design/actions/file/WebPreviewUtils.java
  2. 9
      designer-base/src/com/fr/design/mainframe/JTemplate.java
  3. 6
      designer-base/src/com/fr/design/mainframe/JVirtualTemplate.java
  4. 7
      designer-base/src/com/fr/design/utils/DesignUtils.java
  5. 22
      designer-form/src/com/fr/design/mainframe/JForm.java
  6. 37
      designer-realize/src/com/fr/design/mainframe/JWorkBook.java
  7. 15
      designer-realize/src/com/fr/start/Designer.java

22
designer-base/src/com/fr/design/actions/file/WebPreviewUtils.java

@ -1,5 +1,6 @@
package com.fr.design.actions.file;
import com.fr.design.fun.PreviewProvider;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.utils.DesignUtils;
@ -11,19 +12,22 @@ import com.fr.general.web.ParameterConstants;
import com.fr.stable.project.ProjectConstants;
import javax.swing.*;
import java.util.Collections;
import java.util.Map;
public final class WebPreviewUtils {
public static void onWorkbookPreview(JTemplate<?, ?> jt) {
actionPerformed(jt, jt.getPreviewType().parametersForPreview(), ParameterConstants.REPORTLET);
public static void preview(JTemplate<?, ?> jt) {
preview(jt, null);
}
public static void onFormPreview(JTemplate<?, ?> jt) {
actionPerformed(jt, null, ParameterConstants.FORMLET);
@SuppressWarnings("unchecked")
public static void preview(JTemplate<?, ?> jt, PreviewProvider provider) {
String baseRoute = jt.route();
actionPerformed(jt, baseRoute, provider == null ? Collections.EMPTY_MAP : provider.parametersForPreview(), ParameterConstants.VIEWLET);
}
public static void actionPerformed(JTemplate<?, ?> jt, Map<String, Object> map, String actionType) {
private static void actionPerformed(JTemplate<?, ?> jt, String baseRoute, Map<String, Object> map, String actionType) {
if (jt == null) {
return;
}
@ -43,7 +47,7 @@ public final class WebPreviewUtils {
FILE currentTemplate = jt.getEditingFILE();
// carl:是否是保存在运行环境下的模板,不是就不能被预览
if (currentTemplate instanceof FileNodeFILE) {
browseUrl(currentTemplate, map, actionType, jt);
browseUrl(currentTemplate, baseRoute, map, actionType, jt);
} else {
// 说明模板没有保存在报表运行环境下面,提示用户
int selVal = JOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), Inter.getLocText("Web_Preview_Message"),
@ -54,12 +58,12 @@ public final class WebPreviewUtils {
return;
}
currentTemplate = jt.getEditingFILE();
browseUrl(currentTemplate, map, actionType, jt);
browseUrl(currentTemplate, baseRoute, map, actionType, jt);
}
}
}
private static void browseUrl(FILE currentTemplate, Map<String, Object> map, String actionType, JTemplate<?, ?> jt) {
private static void browseUrl(FILE currentTemplate, String baseRoute, Map<String, Object> map, String actionType, JTemplate<?, ?> jt) {
if (!(currentTemplate instanceof FileNodeFILE)) {
return;
}
@ -80,7 +84,7 @@ public final class WebPreviewUtils {
parameterValueList.add(GeneralUtils.objectToString(map.get(key)));
}
}
DesignUtils.visitEnvServerByParameters(parameterNameList.toArray(new String[parameterNameList.size()]), parameterValueList.toArray(new String[parameterValueList.size()]));
DesignUtils.visitEnvServerByParameters(baseRoute, parameterNameList.toArray(new String[parameterNameList.size()]), parameterValueList.toArray(new String[parameterValueList.size()]));
}
} else {
int selVal = JOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), Inter.getLocText("Web_Preview_Message"),

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

@ -56,13 +56,10 @@ import com.fr.stable.StringUtils;
import com.fr.stable.core.UUID;
import com.fr.stable.project.ProjectConstants;
import javax.swing.BorderFactory;
import javax.swing.Icon;
import javax.swing.JComponent;
import javax.swing.JOptionPane;
import javax.swing.*;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.undo.UndoManager;
import java.awt.BorderLayout;
import java.awt.*;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
@ -1146,4 +1143,6 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
template.addAttrMark(new TemplateIdAttrMark(templateId));
template.setTemplateID(templateId);
}
public abstract String route();
}

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

@ -12,6 +12,7 @@ import com.fr.design.menu.ShortCut;
import com.fr.design.menu.ToolBarDef;
import com.fr.file.FILE;
import com.fr.file.FileNodeFILE;
import com.fr.stable.StringUtils;
import com.fr.stable.project.ProjectConstants;
import javax.swing.Icon;
@ -266,4 +267,9 @@ public class JVirtualTemplate extends JTemplate {
protected void applyUndoState(BaseUndoState baseUndoState) {
}
@Override
public String route() {
return StringUtils.EMPTY;
}
}

7
designer-base/src/com/fr/design/utils/DesignUtils.java

@ -313,7 +313,7 @@ public class DesignUtils {
* 访问服务器环境-空参数
*/
public static void visitEnvServer() {
visitEnvServerByParameters(new String[] {}, new String[] {});
visitEnvServerByParameters(StringUtils.EMPTY, new String[] {}, new String[] {});
}
/**
@ -322,7 +322,7 @@ public class DesignUtils {
* @param names 参数名字
* @param values 参数值
*/
public static void visitEnvServerByParameters(String[] names, String[] values) {
public static void visitEnvServerByParameters(String baseRoute, String[] names, String[] values) {
int len = Math.min(ArrayUtils.getLength(names), ArrayUtils.getLength(values));
String[] segs = new String[len];
for (int i = 0; i < len; i++) {
@ -353,7 +353,8 @@ public class DesignUtils {
} else {
try {
String web = GeneralContext.getCurrentAppNameOfEnv();
String url = "http://localhost:" + DesignerEnvManager.getEnvManager().getJettyServerPort() + "/" + web + "/" + ServerConfig.getInstance().getReportServletName()
String url = "http://localhost:" + DesignerEnvManager.getEnvManager().getJettyServerPort()
+ "/" + web + "/" + ServerConfig.getInstance().getServletName() + baseRoute
+ postfixOfUri;
StartServer.browserURLWithLocalEnv(url);
} catch (Throwable e) {

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

@ -22,7 +22,6 @@ import com.fr.design.designer.creator.XWParameterLayout;
import com.fr.design.designer.properties.FormWidgetAuthorityEditPane;
import com.fr.design.event.TargetModifiedEvent;
import com.fr.design.event.TargetModifiedListener;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.gui.frpane.HyperlinkGroupPane;
import com.fr.design.gui.frpane.HyperlinkGroupPaneActionProvider;
import com.fr.design.gui.ilable.UILabel;
@ -59,18 +58,10 @@ import com.fr.general.Inter;
import com.fr.stable.ArrayUtils;
import com.fr.stable.Constants;
import com.fr.stable.bridge.StableFactory;
import com.fr.web.controller.ViewRequestConstants;
import javax.swing.BorderFactory;
import javax.swing.Icon;
import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Font;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.image.BufferedImage;
@ -683,7 +674,7 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm {
form.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
WebPreviewUtils.onFormPreview(JForm.this);
WebPreviewUtils.preview(JForm.this);
}
});
return new UIMenuItem[]{form};
@ -898,4 +889,9 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm {
XCreator creator = selection.getSelectedCreator();
return creator.toData();
}
@Override
public String route() {
return ViewRequestConstants.FORM_VIEW_PATH;
}
}

37
designer-realize/src/com/fr/design/mainframe/JWorkBook.java

@ -1,12 +1,24 @@
package com.fr.design.mainframe;
import com.fr.base.*;
import com.fr.base.BaseUtils;
import com.fr.base.DynamicUnitList;
import com.fr.base.FRContext;
import com.fr.base.Parameter;
import com.fr.base.ScreenResolution;
import com.fr.design.DesignModelAdapter;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.actions.AllowAuthorityEditAction;
import com.fr.design.actions.ExitAuthorityEditAction;
import com.fr.design.actions.file.WebPreviewUtils;
import com.fr.design.actions.file.export.*;
import com.fr.design.actions.file.export.CSVExportAction;
import com.fr.design.actions.file.export.EmbeddedExportExportAction;
import com.fr.design.actions.file.export.ExcelExportAction;
import com.fr.design.actions.file.export.PDFExportAction;
import com.fr.design.actions.file.export.PageExcelExportAction;
import com.fr.design.actions.file.export.PageToSheetExcelExportAction;
import com.fr.design.actions.file.export.SVGExportAction;
import com.fr.design.actions.file.export.TextExportAction;
import com.fr.design.actions.file.export.WordExportAction;
import com.fr.design.actions.report.ReportExportAttrAction;
import com.fr.design.actions.report.ReportMobileAttrAction;
import com.fr.design.actions.report.ReportParameterAction;
@ -30,7 +42,11 @@ import com.fr.design.mainframe.cell.QuickEditorRegion;
import com.fr.design.mainframe.templateinfo.JWorkBookProcessInfo;
import com.fr.design.mainframe.templateinfo.TemplateProcessInfo;
import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus;
import com.fr.design.menu.*;
import com.fr.design.menu.KeySetUtils;
import com.fr.design.menu.MenuDef;
import com.fr.design.menu.NameSeparator;
import com.fr.design.menu.ShortCut;
import com.fr.design.menu.ToolBarDef;
import com.fr.design.module.DesignModuleFactory;
import com.fr.design.parameter.ParameterDefinitePane;
import com.fr.design.parameter.ParameterInputPane;
@ -51,7 +67,6 @@ import com.fr.file.filetree.FileNode;
import com.fr.general.ComparatorUtils;
import com.fr.general.Inter;
import com.fr.general.ModuleContext;
import com.fr.general.web.ParameterConstants;
import com.fr.grid.Grid;
import com.fr.grid.GridUtils;
import com.fr.io.exporter.EmbeddedTableDataExporter;
@ -75,13 +90,16 @@ import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils;
import com.fr.stable.module.Module;
import com.fr.stable.project.ProjectConstants;
import com.fr.web.controller.ViewRequestConstants;
import javax.swing.*;
import javax.swing.Icon;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.FileOutputStream;
import java.util.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* JWorkBook used to edit WorkBook.
@ -899,7 +917,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
@Override
public void previewMenuActionPerformed(PreviewProvider provider) {
setPreviewType(provider);
WebPreviewUtils.actionPerformed(this, provider.parametersForPreview(), ParameterConstants.REPORTLET);
WebPreviewUtils.preview(this, provider);
}
/**
@ -1129,4 +1147,9 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
//产品想要重新设计下, 1现在的分享多列数据集很麻烦, 2想做成自动上传附件.
// return new UIButton[]{new ShareButton()};
}
@Override
public String route() {
return ViewRequestConstants.REPORT_VIEW_PATH;
}
}

15
designer-realize/src/com/fr/start/Designer.java

@ -22,7 +22,6 @@ import com.fr.design.gui.imenu.UIMenuItem;
import com.fr.design.gui.imenu.UIPopupMenu;
import com.fr.design.gui.itoolbar.UILargeToolbar;
import com.fr.design.mainframe.ActiveKeyGenerator;
import com.fr.design.mainframe.BaseJForm;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.InformationCollector;
import com.fr.design.mainframe.JTemplate;
@ -51,13 +50,9 @@ import com.fr.stable.StringUtils;
import com.fr.stable.xml.XMLTools;
import com.fr.start.module.StartupArgs;
import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.*;
import javax.swing.border.MatteBorder;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Insets;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
@ -265,11 +260,7 @@ public class Designer extends BaseDesigner {
if (jt == null) {
return;
}
if (jt instanceof JWorkBook) {
WebPreviewUtils.onWorkbookPreview(jt);
} else if (jt instanceof BaseJForm) {
WebPreviewUtils.onFormPreview(jt);
}
WebPreviewUtils.preview(jt);
}
@Override

Loading…
Cancel
Save