Browse Source

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

master
zheng 7 years ago
parent
commit
383d45ddf5
  1. 2
      designer-base/src/com/fr/design/actions/file/WebPreviewUtils.java
  2. 11
      designer-base/src/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java
  3. 3
      designer-base/src/com/fr/design/data/datapane/preview/PreviewTablePane.java
  4. 3
      designer-base/src/com/fr/design/data/tabledata/tabledatapane/FileTableDataPane.java
  5. 4
      designer-base/src/com/fr/design/hyperlink/WebHyperNorthPane.java
  6. 6
      designer-base/src/com/fr/design/mainframe/TemplatePane.java
  7. 8
      designer-base/src/com/fr/env/RemoteEnvPane.java
  8. 4
      designer-base/src/com/fr/start/server/FineEmbedServerActivator.java
  9. 8
      designer-form/src/com/fr/design/designer/creator/XWAbsoluteLayout.java
  10. 4
      designer-realize/src/com/fr/design/actions/file/export/AbstractExportAction.java
  11. 45
      designer-realize/src/com/fr/poly/PolyDesignUI.java
  12. 9
      designer-realize/src/com/fr/start/Designer.java
  13. 10
      designer-realize/src/com/fr/start/fx/FastGifImage.java
  14. 65
      designer-realize/src/com/fr/start/module/DesignerModuleActivator.java
  15. 3
      designer-realize/src/com/fr/start/module/EnvBasedModule.java
  16. 6
      designer-realize/src/com/fr/start/module/PreStartActivator.java

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

@ -20,7 +20,7 @@ import java.util.Map;
public final class WebPreviewUtils {
public static void preview(JTemplate<?, ?> jt) {
preview(jt, null);
preview(jt, jt.getPreviewType());
}
@SuppressWarnings("unchecked")

11
designer-base/src/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java

@ -36,6 +36,7 @@ public abstract class DatabaseConnectionPane<E extends com.fr.data.impl.Connecti
private UIButton okButton;
private UIButton cancelButton;
private JDialog dialog;
private UILabel uiLabel;
// Database pane
public DatabaseConnectionPane() {
@ -46,6 +47,7 @@ public abstract class DatabaseConnectionPane<E extends com.fr.data.impl.Connecti
originalCharSetComboBox = new UIComboBox(EncodeConstants.ALL_ENCODING_ARRAY);
newCharSetComboBox = new UIComboBox(EncodeConstants.ALL_ENCODING_ARRAY);
message = new UILabel();
uiLabel = new UILabel();
okButton = new UIButton(Inter.getLocText("OK"));
cancelButton = new UIButton(Inter.getLocText("Cancel"));
this.setLayout(FRGUIPaneFactory.createBorderLayout());
@ -113,6 +115,7 @@ public abstract class DatabaseConnectionPane<E extends com.fr.data.impl.Connecti
ActionListener testConnectionActionListener = new ActionListener() {
public void actionPerformed(ActionEvent evt) {
// Try the java connection.
final SwingWorker connectionThread = new SwingWorker() {
protected Object doInBackground() throws Exception {
@ -121,6 +124,11 @@ public abstract class DatabaseConnectionPane<E extends com.fr.data.impl.Connecti
boolean connect = DataOperator.getInstance().testConnection(database);
okButton.setEnabled(true);
message.setText(database.connectMessage(connect));
if (connect) {
uiLabel.setIcon(UIManager.getIcon("OptionPane.informationIcon"));
}else{
uiLabel.setIcon(UIManager.getIcon("OptionPane.errorIcon"));
}
} catch (Exception exp) {
FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
}
@ -165,7 +173,8 @@ public abstract class DatabaseConnectionPane<E extends com.fr.data.impl.Connecti
JPanel jp = new JPanel();
JPanel upPane = new JPanel();
JPanel downPane = new JPanel();
UILabel uiLabel = new UILabel(UIManager.getIcon("OptionPane.informationIcon"));
uiLabel = new UILabel(UIManager.getIcon("OptionPane.informationIcon"));
upPane.setLayout(new FlowLayout(FlowLayout.LEFT, 10, 10));
upPane.add(uiLabel);
upPane.add(message);

3
designer-base/src/com/fr/design/data/datapane/preview/PreviewTablePane.java

@ -390,7 +390,8 @@ public class PreviewTablePane extends BasicPane {
} catch (Exception e) {
if (!(e instanceof CancellationException)) {
FRContext.getLogger().error(e.getMessage(), e);
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), e.getMessage());
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), e.getMessage(),
null, 0, UIManager.getIcon("OptionPane.errorIcon"));
}
dialog.setVisible(false);
} finally {

3
designer-base/src/com/fr/design/data/tabledata/tabledatapane/FileTableDataPane.java

@ -221,7 +221,8 @@ public class FileTableDataPane extends AbstractTableDataPane<FileTableData> {
FRContext.getLogger().error(e.getMessage(), e);
}
if (in == null) {
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Inter.getLocText("Datasource-Connection_failed"));
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Inter.getLocText("Datasource-Connection_failed"),
null, 0, UIManager.getIcon("OptionPane.errorIcon"));
} else {
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Inter.getLocText("Datasource-Connection_successfully"));
try {

4
designer-base/src/com/fr/design/hyperlink/WebHyperNorthPane.java

@ -24,7 +24,7 @@ import java.awt.BorderLayout;
public class WebHyperNorthPane extends AbstractHyperNorthPane<WebHyperlink> {
private UITextField itemNameTextField;
private boolean needRenamePane = false;
private UITextArea urlTextField;
private UITextField urlTextField;
public WebHyperNorthPane(boolean needRenamePane) {
this.needRenamePane = needRenamePane;
@ -48,7 +48,7 @@ public class WebHyperNorthPane extends AbstractHyperNorthPane<WebHyperlink> {
protected JPanel setHeaderPanel() {
JPanel headerPane = FRGUIPaneFactory.createBorderLayout_L_Pane();
urlTextField = new UITextArea(1,headerPane.getWidth());
urlTextField = new UITextField(headerPane.getWidth());
urlTextField.setText(ProductConstants.WEBSITE_URL);
JPanel urlWithHelp = GUICoreUtils.createNamedPane(urlTextField, "URL:");

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

@ -137,7 +137,8 @@ public class TemplatePane extends JPanel implements MouseListener {
@Override
public void fail() {
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Inter.getLocText(new String[]{"M-SwitchWorkspace", "Failed"}));
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Inter.getLocText(new String[]{"M-SwitchWorkspace", "Failed"}),
null, 0, UIManager.getIcon("OptionPane.errorIcon"));
}
@Override
@ -152,7 +153,8 @@ public class TemplatePane extends JPanel implements MouseListener {
}
setJLabel(selectedName);
} catch (Exception e) {
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Inter.getLocText(new String[]{"M-SwitchWorkspace", "Failed"}));
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Inter.getLocText(new String[]{"M-SwitchWorkspace", "Failed"}),
null, 0, UIManager.getIcon("OptionPane.errorIcon"));
return false;
}
TemplateTreePane.getInstance().refreshDockingView();

8
designer-base/src/com/fr/env/RemoteEnvPane.java vendored

@ -64,7 +64,7 @@ public class RemoteEnvPane extends BasicBeanPane<RemoteDesignerWorkspaceInfo> {
private UILabel message = new UILabel();
private UIButton okButton = new UIButton(Inter.getLocText("OK"));
private UIButton cancelButton = new UIButton(Inter.getLocText("Cancel"));
;
private UILabel uiLabel = new UILabel();
/**
* 是否启用 https 勾选框
@ -477,6 +477,7 @@ public class RemoteEnvPane extends BasicBeanPane<RemoteDesignerWorkspaceInfo> {
protected Boolean doInBackground() throws Exception {
final RemoteDesignerWorkspaceInfo remoteEnv = updateBean();
return WorkContext.getConnector().testConnection(remoteEnv.getConnection());
}
@ -486,11 +487,14 @@ public class RemoteEnvPane extends BasicBeanPane<RemoteDesignerWorkspaceInfo> {
try {
if (get()) {
message.setText(Inter.getLocText("Fine-Designer_Basic_Remote_Connect_Successful"));
uiLabel.setIcon(UIManager.getIcon("OptionPane.informationIcon"));
} else {
message.setText(Inter.getLocText("Fine-Designer_Basic_Remote_Connect_Failed"));
uiLabel.setIcon(UIManager.getIcon("OptionPane.errorIcon"));
}
} catch (InterruptedException | ExecutionException e) {
message.setText(Inter.getLocText("Fine-Designer_Basic_Remote_Connect_Failed"));
uiLabel.setIcon(UIManager.getIcon("OptionPane.errorIcon"));
}
}
};
@ -530,7 +534,7 @@ public class RemoteEnvPane extends BasicBeanPane<RemoteDesignerWorkspaceInfo> {
JPanel jp = new JPanel();
JPanel upPane = new JPanel();
JPanel downPane = new JPanel();
UILabel uiLabel = new UILabel(UIManager.getIcon("OptionPane.informationIcon"));
uiLabel = new UILabel(UIManager.getIcon("OptionPane.informationIcon"));
upPane.setLayout(new FlowLayout(FlowLayout.LEFT, 10, 10));
upPane.add(uiLabel);
upPane.add(message);

4
designer-base/src/com/fr/start/server/FineEmbedServerActivator.java

@ -5,6 +5,7 @@ import com.fr.design.DesignerEnvManager;
import com.fr.log.FineLoggerFactory;
import com.fr.module.Activator;
import com.fr.module.ModuleRole;
import com.fr.stable.EncodeConstants;
import com.fr.startup.FineWebApplicationInitializer;
import com.fr.third.springframework.web.SpringServletContainerInitializer;
import com.fr.third.springframework.web.context.support.AnnotationConfigWebApplicationContext;
@ -12,6 +13,7 @@ import com.fr.workspace.WorkContext;
import org.apache.catalina.Context;
import org.apache.catalina.LifecycleException;
import org.apache.catalina.Wrapper;
import org.apache.catalina.connector.Connector;
import org.apache.catalina.loader.VirtualWebappLoader;
import org.apache.catalina.startup.Tomcat;
@ -55,6 +57,8 @@ public class FineEmbedServerActivator extends Activator {
tomcat = new Tomcat();
tomcat.setPort(DesignerEnvManager.getEnvManager().getEmbedServerPort());
// 设置解码uri使用的字符编码
tomcat.getConnector().setURIEncoding(EncodeConstants.ENCODING_UTF_8);
String docBase = new File(WorkContext.getCurrent().getPath()).getParent();
String appName = "/" + FRContext.getCommonOperator().getAppName();
Context context = tomcat.addContext(appName, docBase);

8
designer-form/src/com/fr/design/designer/creator/XWAbsoluteLayout.java

@ -248,10 +248,10 @@ public class XWAbsoluteLayout extends XLayoutContainer {
for (int i = 0; i < this.getComponentCount(); i++) {
XCreator creator = getXCreator(i);
Rectangle rec = new Rectangle(creator.getBounds());
rec.x = (int) (rec.x / prevContainerPercent * containerPercent);
rec.y = (int) (rec.y / prevContainerPercent * containerPercent);
rec.height = (int) (rec.height / prevContainerPercent * containerPercent);
rec.width = (int) (rec.width / prevContainerPercent * containerPercent);
rec.x = (int)Math.round (rec.x / prevContainerPercent * containerPercent);
rec.y = (int)Math.round (rec.y / prevContainerPercent * containerPercent);
rec.height = (int)Math.round (rec.height / prevContainerPercent * containerPercent);
rec.width = (int)Math.round (rec.width / prevContainerPercent * containerPercent);
BoundsWidget wgt = (BoundsWidget) toData().getBoundsWidget(creator.toData());
wgt.setBounds(rec);
creator.setBounds(rec);

4
designer-realize/src/com/fr/design/actions/file/export/AbstractExportAction.java

@ -3,6 +3,7 @@
*/
package com.fr.design.actions.file.export;
import com.fr.Message.ErrorMessage_;
import com.fr.base.FRContext;
import com.fr.base.Parameter;
import com.fr.design.actions.JWorkBookAction;
@ -133,7 +134,8 @@ public abstract class AbstractExportAction extends JWorkBookAction {
} catch (Exception exp) {
this.setProgress(100);
FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Inter.getLocText("FR-Designer_Export_failed") + "\n" + filePath);
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Inter.getLocText("FR-Designer_Export_failed") + "\n" + filePath,
null, 0, UIManager.getIcon("OptionPane.errorIcon"));
}
return null;
}

45
designer-realize/src/com/fr/poly/PolyDesignUI.java

@ -3,30 +3,23 @@
*/
package com.fr.poly;
import java.awt.*;
import java.awt.geom.Rectangle2D;
import java.awt.image.BufferedImage;
import java.text.DecimalFormat;
import java.util.ArrayList;
import javax.swing.JComponent;
import javax.swing.JScrollBar;
import javax.swing.plaf.ComponentUI;
import com.fr.base.GraphHelper;
import com.fr.base.Margin;
import com.fr.base.PaperSize;
import com.fr.base.ScreenResolution;
import com.fr.base.iofile.attr.WatermarkAttr;
import com.fr.design.utils.ComponentUtils;
import com.fr.general.Background;
import com.fr.general.ComparatorUtils;
import com.fr.general.Inter;
import com.fr.main.FineBook;
import com.fr.page.PaperSettingProvider;
import com.fr.page.ReportSettingsProvider;
import com.fr.page.WatermarkPainter;
import com.fr.poly.creator.BlockCreator;
import com.fr.poly.creator.ECBlockCreator;
import com.fr.poly.creator.ECBlockEditor;
import com.fr.poly.model.AddedData;
import com.fr.poly.model.AddingData;
import com.fr.report.core.ReportUtils;
import com.fr.report.report.Report;
import com.fr.report.report.TemplateReport;
import com.fr.report.stable.ReportConstants;
@ -34,6 +27,21 @@ import com.fr.stable.Constants;
import com.fr.stable.CoreGraphHelper;
import com.fr.stable.unit.UNIT;
import javax.swing.JComponent;
import javax.swing.JScrollBar;
import javax.swing.plaf.ComponentUI;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.RenderingHints;
import java.awt.geom.Rectangle2D;
import java.awt.image.BufferedImage;
import java.text.DecimalFormat;
import java.util.ArrayList;
/**
* @author richer
* @since 6.5.3 聚合报表设计块的ui类
@ -48,6 +56,7 @@ public class PolyDesignUI extends ComponentUI {
private PolyDesigner designer;
private int resolution;
private float time;
private WatermarkPainter watermarkPainter;
public PolyDesignUI(int resolution) {
if (resolution == 0){
@ -97,6 +106,18 @@ public class PolyDesignUI extends ComponentUI {
paintAddingData(g2d, addData);
}
paintPaginateLine(g2d);
paintWatermark(g2d, designer.getTarget().getBook(), c.getWidth(), c.getHeight());
}
// 绘制水印
private void paintWatermark(Graphics2D g2d, FineBook book, int width, int height) {
WatermarkAttr watermark = ReportUtils.getWatermarkFromAttrMarkFile(book);
// 不要每次都 new 一个 WatermarkPainter
if (watermarkPainter == null || !ComparatorUtils.equals(watermarkPainter.getWatermark(), watermark)) {
watermarkPainter = new WatermarkPainter(watermark);
}
watermarkPainter.paint(g2d, width, height);
}
private void paintAddedData(Graphics g) {

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

@ -35,6 +35,9 @@ import com.fr.design.menu.MenuDef;
import com.fr.design.menu.SeparatorDef;
import com.fr.design.menu.ShortCut;
import com.fr.design.module.DesignModuleFactory;
import com.fr.design.utils.DesignUtils;
import com.fr.design.utils.concurrent.ThreadFactoryBuilder;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.CloudCenter;
@ -97,6 +100,12 @@ public class Designer extends BaseDesigner {
BuildContext.setBuildFilePath("/com/fr/stable/build.properties");
preloadResource();
SplashContext.getInstance().registerSplash(createSplash());
// 如果端口被占用了 说明程序已经运行了一次,也就是说,已经建立一个监听服务器,现在只要给服务器发送命令就好了
if (DesignUtils.isStarted()) {
DesignUtils.clientSend(args);
return;
}
SplashContext.getInstance().show();
Module designerRoot = ModuleContext.parseRoot("designer-startup.xml");
//传递启动参数

10
designer-realize/src/com/fr/start/fx/FastGifImage.java

@ -97,17 +97,7 @@ public class FastGifImage extends WritableImage {
}
}
private void finishImage(Exception e) {
e.printStackTrace();
}
private void finishImage(ImageLoader loader) {
final Exception loadingException = loader.getException();
if (loadingException != null) {
finishImage(loadingException);
return;
}
initializeAnimatedImage(loader);
}

65
designer-realize/src/com/fr/start/module/DesignerModuleActivator.java

@ -48,6 +48,7 @@ import com.fr.design.javascript.EmailPane;
import com.fr.design.javascript.JavaScriptImplPane;
import com.fr.design.javascript.ParameterJavaScriptPane;
import com.fr.design.javascript.ProcessTransitionAdapter;
import com.fr.design.mainframe.AbstractAppProvider;
import com.fr.design.mainframe.App;
import com.fr.design.mainframe.BaseJForm;
import com.fr.design.mainframe.ChartPropertyPane;
@ -77,6 +78,7 @@ import com.fr.design.parameter.WorkBookParameterReader;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.design.widget.ui.btn.FormSubmitButtonDetailPane;
import com.fr.file.FILE;
import com.fr.form.main.Form;
import com.fr.form.stable.ElementCaseThumbnailProcessor;
import com.fr.form.ui.ChartEditor;
import com.fr.general.ComparatorUtils;
@ -117,6 +119,7 @@ import com.fr.report.cell.cellattr.core.group.DSColumn;
import com.fr.report.cell.painter.BiasTextPainter;
import com.fr.report.cell.painter.CellImagePainter;
import com.fr.stable.ArrayUtils;
import com.fr.stable.Constants;
import com.fr.stable.ParameterProvider;
import com.fr.stable.StringUtils;
import com.fr.stable.bridge.StableFactory;
@ -134,16 +137,14 @@ import com.fr.van.chart.DownloadOnlineSourcesHelper;
import com.fr.van.chart.map.server.ChartMapEditorAction;
import com.fr.xml.ReportXMLUtils;
import javax.swing.JDialog;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import java.awt.BorderLayout;
import java.awt.Image;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.image.BufferedImage;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
@ -348,7 +349,8 @@ public class DesignerModuleActivator extends Activator implements Prepare {
* @return 可以打开的模板类型的数组
*/
private static App[] apps4TemplateOpener() {
return new App[]{getCptxApp(), getCptApp(), getXlsApp(), getXlsxApp()};
return new App[]{getCptxApp(), getCptApp(), getXlsApp(), getXlsxApp(), getFrmApp()};
}
private static AbstractWorkBookApp getXlsxApp() {
@ -370,6 +372,57 @@ public class DesignerModuleActivator extends Activator implements Prepare {
}
};
}
private static AbstractAppProvider getFrmApp() {
return new AbstractAppProvider<Form>() {
@Override
public String[] defaultExtensions() {
return new String[]{"frm", "form"};
}
@Override
public JTemplate<Form, ?> openTemplate(FILE tplFile) {
HashMap<String, Class> classType = new HashMap<String, Class>();
classType.put(Constants.ARG_0, Form.class);
classType.put(Constants.ARG_1, FILE.class);
return (JTemplate<Form, ?>) StableFactory.getMarkedInstanceObjectFromClass(BaseJForm.XML_TAG,
new Object[]{asIOFile(tplFile), tplFile}, classType, BaseJForm.class);
}
@Override
public Form asIOFile(FILE file) {
if (XMLEncryptUtils.isCptEncoded() &&
!XMLEncryptUtils.checkVaild(DesignerEnvManager.getEnvManager().getEncryptionKey())) {
if (!new DecodeDialog(file).isPwdRight()) {
FRContext.getLogger().error(Inter.getLocText("FR-Engine_ECP_error_pwd"));
return new Form();
}
}
// peter:打开新报表.
Form tpl = new Form();
// richer:打开报表通知
// FRContext.getLogger().info(Inter.getLocText("LOG-Is_Being_Openned") + "\"" + file.getName() + "\"" + "," + Inter.getLocText("LOG-Please_Wait") + "...");
FRContext.getLogger().info(Inter.getLocText(new String[]{"LOG-Is_Being_Openned", "LOG-Please_Wait"},
new String[]{"\"" + file.getName() + "\"" + ",", "..."}));
try {
tpl.readStream(file.asInputStream());
} catch (Exception exp) {
FRContext.getLogger().error("Failed to generate frm from " + file, exp);
return null;
}
return tpl;
}
};
}
private static AbstractWorkBookApp getXlsApp() {
return new AbstractWorkBookApp() {

3
designer-realize/src/com/fr/start/module/EnvBasedModule.java

@ -1,5 +1,6 @@
package com.fr.start.module;
import com.fr.chart.activator.ChartBaseActivator;
import com.fr.module.Activator;
import com.fr.stable.CoreActivator;
import com.fr.start.server.FineEmbedServer;
@ -14,6 +15,7 @@ public class EnvBasedModule extends Activator {
public void start() {
//core和设计器启动
startSub(CoreActivator.class);
startSub(ChartBaseActivator.class);
getSub("designer").start();
//这里不启动tomcat,由客户手动触发
}
@ -24,6 +26,7 @@ public class EnvBasedModule extends Activator {
FineEmbedServer.stop();
//倒叙关闭其他模块
getSub("designer").stop();
stopSub(ChartBaseActivator.class);
stopSub(CoreActivator.class);
}
}

6
designer-realize/src/com/fr/start/module/PreStartActivator.java

@ -38,11 +38,7 @@ public class PreStartActivator extends Activator {
} else {
DesignUtils.setPort(getStartPort());
}
// 如果端口被占用了 说明程序已经运行了一次,也就是说,已经建立一个监听服务器,现在只要给服务器发送命令就好了
if (DesignUtils.isStarted()) {
DesignUtils.clientSend(getModule().upFindSingleton(StartupArgs.class).get());
return true;
}
return false;
}

Loading…
Cancel
Save