Browse Source

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

master
daniel 7 years ago
parent
commit
dec7604338
  1. 24
      designer-base/src/main/java/com/fr/design/DesignerEnvManager.java
  2. 3
      designer-base/src/main/java/com/fr/design/report/WatermarkPreviewPane.java
  3. 3
      designer-base/src/main/java/com/fr/design/style/background/gradient/GradientBar.java
  4. 93
      designer-base/src/main/java/com/fr/design/style/color/ColorSelectConfigManager.java
  5. 3
      designer-base/src/main/java/com/fr/design/style/color/ColorSelectPane.java
  6. 3
      designer-base/src/main/java/com/fr/design/style/color/NewColorSelectPane.java
  7. 5
      designer-base/src/main/java/com/fr/design/style/color/UsedColorPane.java
  8. 3
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartAccColorPane.java
  9. 7
      designer-chart/src/main/java/com/fr/van/chart/range/component/LegendGradientBar.java
  10. 34
      designer-form/src/main/java/com/fr/design/mainframe/FormDesignerUI.java
  11. 3
      designer-realize/src/main/java/com/fr/design/webattr/EditReportServerParameterPane.java
  12. 24
      designer-realize/src/main/java/com/fr/grid/GridUI.java
  13. 10
      designer-realize/src/main/java/com/fr/poly/PolyDesignUI.java

24
designer-base/src/main/java/com/fr/design/DesignerEnvManager.java

@ -13,6 +13,7 @@ import com.fr.design.env.DesignerWorkspaceInfo;
import com.fr.design.env.DesignerWorkspaceType;
import com.fr.design.env.LocalDesignerWorkspaceInfo;
import com.fr.design.env.RemoteDesignerWorkspaceInfo;
import com.fr.design.style.color.ColorSelectConfigManager;
import com.fr.file.FILEFactory;
import com.fr.general.ComparatorUtils;
import com.fr.general.FRLogFormatter;
@ -129,7 +130,8 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
//记录当前激活码的在线激活状态.
private int activeKeyStatus = -1;
private boolean joinProductImprove = true;
//最近使用的颜色
private ColorSelectConfigManager configManager = new ColorSelectConfigManager();
/**
* alphafine
*/
@ -190,6 +192,10 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
return designerEnvManager;
}
public ColorSelectConfigManager getColorConfigManager(){
return this.configManager;
}
public static void checkNameEnvMap() {
if (designerEnvManager == null || designerEnvManager.nameEnvMap.size() > 0) {
return;
@ -1299,6 +1305,10 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
}
}
private void readRecentColor(XMLableReader reader){
reader.readXMLObject(this.configManager);
}
/**
* Read XML.<br>
* The method will be invoked when read data from XML file.<br>
@ -1350,7 +1360,10 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
readHttpsParas(reader);
} else if (name.equals("AlphaFineConfigManager")) {
readAlphaFineAttr(reader);
} else {
} else if (name.equals("RecentColors")) {
readRecentColor(reader);
}
else {
readLayout(reader, name);
}
}
@ -1542,6 +1555,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
writeActiveStatus(writer);
writeHttpsParas(writer);
writeAlphaFineAttr(writer);
writeRecentColor(writer);
writer.end();
}
@ -1551,6 +1565,12 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
}
}
private void writeRecentColor(XMLPrintWriter writer) {
if (this.configManager != null) {
this.configManager.writeXML(writer);
}
}
public String getUUID() {
return StringUtils.isEmpty(uuid) ? UUID.randomUUID().toString() : uuid;
}

3
designer-base/src/main/java/com/fr/design/report/WatermarkPreviewPane.java

@ -32,6 +32,7 @@ public class WatermarkPreviewPane extends JPanel {
super.paint(g);
Graphics2D g2d = (Graphics2D)g;
g2d.drawImage(UIConstants.WATERMARK_BACKGROUND, 0, 0, this.getWidth(), this.getHeight(), null);
new WatermarkPainter(watermark).paint(g2d, this.getWidth(), this.getHeight());
WatermarkPainter painter = WatermarkPainter.createPainter(watermark);
painter.paint(g2d, this.getWidth(), this.getHeight());
}
}

3
designer-base/src/main/java/com/fr/design/style/background/gradient/GradientBar.java

@ -19,6 +19,7 @@ import javax.swing.event.ChangeListener;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import com.fr.design.DesignerEnvManager;
import com.fr.design.event.UIObserver;
import com.fr.design.event.UIObserverListener;
import com.fr.design.gui.itextfield.UINumberField;
@ -104,7 +105,7 @@ public class GradientBar extends JComponent implements UIObserver,ColorSelectabl
ColorSelectDialog.showDialog(DesignerContext.getDesignerFrame(), pane, Color.WHITE, GradientBar.this);
Color color = GradientBar.this.getColor();
if (color != null) {
ColorSelectConfigManager.getInstance().addToColorQueue(color);
DesignerEnvManager.getEnvManager().getColorConfigManager().addToColorQueue(color);
list.get(select).setColorInner(color);
stateChanged();
GradientBar.this.repaint();

93
designer-base/src/main/java/com/fr/design/style/color/ColorSelectConfigManager.java

@ -1,16 +1,12 @@
package com.fr.design.style.color;
import com.fr.base.FRContext;
import com.fr.file.XMLFileManager;
import com.fr.general.ComparatorUtils;
import com.fr.general.GeneralContext;
import com.fr.stable.EnvChangedListener;
import com.fr.stable.xml.XMLPrintWriter;
import com.fr.stable.xml.XMLTools;
import com.fr.stable.xml.XMLReadable;
import com.fr.stable.xml.XMLableReader;
import java.awt.*;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
@ -19,42 +15,20 @@ import java.util.List;
*
* @author focus
*/
public class ColorSelectConfigManager extends XMLFileManager implements ColorSelectConfigManagerProvider {
public class ColorSelectConfigManager implements XMLReadable {
// 最近使用的颜色个数
private int colorNums = 20;
private static ColorSelectConfigManagerProvider configManager = null;
private static ColorSelectConfigManager colorSelectConfigManager = null;
private boolean init = true;
// 最近使用颜色
private List<Color> colors = new ArrayList<Color>();
private static final String RECENT_COLOR_TAG = "RecentColors";
private static final String COLOR_TAG = "Color";
static {
GeneralContext.addEnvChangedListener(new EnvChangedListener() {
public void envChanged() {
ColorSelectConfigManager.envChanged();
}
});
}
private static void envChanged() {
configManager = null;
}
public Color[] getColors() {
//初次打开软件时从xml文件中获取历史颜色信息
if (init) {
ColorSelectConfigManagerProvider manager = ColorSelectConfigManager.getProviderInstance();
this.colors = manager.getColorsFromFile();
init = false;
}
if (colors == null) {
colors = new ArrayList<Color>();
}
return colors.toArray(new Color[colors.size()]);
}
@ -66,12 +40,6 @@ public class ColorSelectConfigManager extends XMLFileManager implements ColorSel
this.colorNums = colorNums;
}
public synchronized static ColorSelectConfigManager getInstance() {
if (colorSelectConfigManager == null) {
colorSelectConfigManager = new ColorSelectConfigManager();
}
return colorSelectConfigManager;
}
/**
* 添加颜色到最近使用队列中
@ -91,52 +59,24 @@ public class ColorSelectConfigManager extends XMLFileManager implements ColorSel
/*@author yaohwu*/
//将历史颜色信息保存到xml文件中去
ColorSelectConfigManagerProvider manager = ColorSelectConfigManager.getProviderInstance();
if (colors != null && !colors.isEmpty()) {
manager.setColorsToFile(colors);
}
}
/**
* 读取配置文件流
*
* @param input
* @throws Exception 异常
*/
@Override
public void readFromInputStream(InputStream input) throws Exception {
ColorSelectConfigManager manager = new ColorSelectConfigManager();
XMLTools.readInputStreamXML(manager, input);
configManager = manager;
}
/**
* 获取配置管理接口
*
* @return 配置管理接口ConfigManagerProvider
*/
public synchronized static ColorSelectConfigManagerProvider getProviderInstance() {
if (configManager == null) {
configManager = new ColorSelectConfigManager();
configManager.readXMLFile();
this.setColorsToFile(colors);
}
return configManager;
}
public String fileName() {
return "recentcolors.xml";
}
public void readXML(XMLableReader reader) {
String name = reader.getTagName();
if (reader.isChildNode()) {
if (ComparatorUtils.equals(COLOR_TAG, name)) {
Color color = null;
colors.add(reader.getAttrAsColor("colors", color));
reader.readXMLObject(new XMLReadable() {
@Override
public void readXML(XMLableReader reader) {
String tagName = reader.getTagName();
if (reader.isChildNode()) {
if (ComparatorUtils.equals(COLOR_TAG, tagName)) {
Color color = null;
colors.add(reader.getAttrAsColor("colors", color));
}
}
}
}
});
}
public void writeXML(XMLPrintWriter writer) {
@ -151,9 +91,6 @@ public class ColorSelectConfigManager extends XMLFileManager implements ColorSel
writer.end();
}
public List<Color> getColorsFromFile() {
return this.colors;
}
public void setColorsToFile(List<Color> colors) {
this.colors = colors;

3
designer-base/src/main/java/com/fr/design/style/color/ColorSelectPane.java

@ -3,6 +3,7 @@
*/
package com.fr.design.style.color;
import com.fr.design.DesignerEnvManager;
import com.fr.design.border.UIRoundedBorder;
import com.fr.design.constants.UIConstants;
import com.fr.design.gui.ibutton.UIButton;
@ -159,7 +160,7 @@ public class ColorSelectPane extends TransparentPane implements ColorSelectable
}
}
ColorSelectConfigManager.getInstance().addToColorQueue(color);
DesignerEnvManager.getEnvManager().getColorConfigManager().addToColorQueue(color);
this.repaint();
}

3
designer-base/src/main/java/com/fr/design/style/color/NewColorSelectPane.java

@ -1,5 +1,6 @@
package com.fr.design.style.color;
import com.fr.design.DesignerEnvManager;
import com.fr.design.border.UIRoundedBorder;
import com.fr.design.constants.UIConstants;
import com.fr.design.dialog.BasicPane;
@ -163,7 +164,7 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable {
this.colorChangeListenerList.get(i).stateChanged(evt);
}
}
ColorSelectConfigManager.getInstance().addToColorQueue(color);
DesignerEnvManager.getEnvManager().getColorConfigManager().addToColorQueue(color);
this.repaint();
}

5
designer-base/src/main/java/com/fr/design/style/color/UsedColorPane.java

@ -1,5 +1,6 @@
package com.fr.design.style.color;
import com.fr.design.DesignerEnvManager;
import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.ibutton.SpecialUIButton;
@ -66,7 +67,7 @@ public class UsedColorPane extends BasicPane {
panel.setLayout(new GridLayout(rows, columns, 1, 1));
panel.setBorder(BorderFactory.createEmptyBorder(8, 8, 0, 8));
//最近使用颜色
Color[] colors = ColorSelectConfigManager.getInstance().getColors();
Color[] colors = DesignerEnvManager.getEnvManager().getColorConfigManager().getColors();
int size = colors.length;
int i = 0;
if (needPickColorButton) {
@ -96,7 +97,7 @@ public class UsedColorPane extends BasicPane {
*/
public void updateUsedColor() {
int total = columns * rows;
Color[] colors = ColorSelectConfigManager.getInstance().getColors();
Color[] colors = DesignerEnvManager.getEnvManager().getColorConfigManager().getColors();
int size = colors.length;
for (int i = this.reserveCells; i < total; i++) {
ColorCell cell = (ColorCell) this.pane.getComponent(i);

3
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartAccColorPane.java

@ -1,6 +1,7 @@
package com.fr.design.mainframe.chart.gui.style;
import com.fr.chart.base.ChartConstants;
import com.fr.design.DesignerEnvManager;
import com.fr.design.dialog.BasicPane;
import com.fr.design.event.UIObserver;
import com.fr.design.event.UIObserverListener;
@ -122,7 +123,7 @@ public class ChartAccColorPane extends BasicPane implements MouseListener, UIObs
Color choosedColor = this.getColor();
if (choosedColor != null) {
colors[currentIndex] = choosedColor;
ColorSelectConfigManager.getInstance().addToColorQueue(choosedColor);
DesignerEnvManager.getEnvManager().getColorConfigManager().addToColorQueue(choosedColor);
ChartAccColorPane.this.stateChanged();
}
ChartAccColorPane.this.repaint();

7
designer-chart/src/main/java/com/fr/van/chart/range/component/LegendGradientBar.java

@ -1,6 +1,7 @@
package com.fr.van.chart.range.component;
import com.fr.chart.base.ChartBaseUtils;
import com.fr.design.DesignerEnvManager;
import com.fr.design.event.UIObserver;
import com.fr.design.event.UIObserverListener;
import com.fr.design.mainframe.DesignerContext;
@ -263,7 +264,7 @@ public class LegendGradientBar extends JComponent implements ColorSelectable, UI
ColorSelectDialog.showDialog(DesignerContext.getDesignerFrame(), pane, Color.WHITE, LegendGradientBar.this);
Color color = LegendGradientBar.this.getColor();
if (color != null) {
ColorSelectConfigManager.getInstance().addToColorQueue(color);
DesignerEnvManager.getEnvManager().getColorConfigManager().addToColorQueue(color);
selectColorPointBtnList.get(select).setColorInner(color);
LegendGradientBar.this.repaint();
@ -276,7 +277,7 @@ public class LegendGradientBar extends JComponent implements ColorSelectable, UI
ColorSelectDialog.showDialog(DesignerContext.getDesignerFrame(), pane, Color.WHITE, LegendGradientBar.this);
Color color = LegendGradientBar.this.getColor();
if (color != null) {
ColorSelectConfigManager.getInstance().addToColorQueue(color);
DesignerEnvManager.getEnvManager().getColorConfigManager().addToColorQueue(color);
selectColorSlotBtnStart.setColorInner(color);
//stateChanged();
LegendGradientBar.this.repaint();
@ -286,7 +287,7 @@ public class LegendGradientBar extends JComponent implements ColorSelectable, UI
ColorSelectDialog.showDialog(DesignerContext.getDesignerFrame(), pane, Color.WHITE, LegendGradientBar.this);
Color color = LegendGradientBar.this.getColor();
if (color != null) {
ColorSelectConfigManager.getInstance().addToColorQueue(color);
DesignerEnvManager.getEnvManager().getColorConfigManager().addToColorQueue(color);
selectColorSlotBtnEnd.setColorInner(color);
//stateChanged();
LegendGradientBar.this.repaint();

34
designer-form/src/main/java/com/fr/design/mainframe/FormDesignerUI.java

@ -1,18 +1,5 @@
package com.fr.design.mainframe;
import java.awt.AlphaComposite;
import java.awt.Component;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Rectangle;
import java.awt.geom.Area;
import java.awt.geom.Rectangle2D;
import java.util.ArrayList;
import javax.swing.JComponent;
import javax.swing.SwingUtilities;
import javax.swing.plaf.ComponentUI;
import com.fr.base.BaseUtils;
import com.fr.base.GraphHelper;
import com.fr.base.ScreenResolution;
@ -30,12 +17,23 @@ import com.fr.design.designer.creator.XWFitLayout;
import com.fr.design.form.util.XCreatorConstants;
import com.fr.design.roleAuthority.ReportAndFSManagePane;
import com.fr.design.utils.ComponentUtils;
import com.fr.general.ComparatorUtils;
import com.fr.general.Inter;
import com.fr.page.WatermarkPainter;
import com.fr.report.core.ReportUtils;
import com.fr.stable.ArrayUtils;
import javax.swing.JComponent;
import javax.swing.SwingUtilities;
import javax.swing.plaf.ComponentUI;
import java.awt.AlphaComposite;
import java.awt.Component;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Rectangle;
import java.awt.geom.Area;
import java.awt.geom.Rectangle2D;
import java.util.ArrayList;
/**
* FormDesigner的UI类是一个有状态的UI类它根据FormDesigner的当前状态画出
* 具有所见即所得的设计界面以及当前设计界面的一些辅助状态比如选择标识拖动区域 以及当前正在添加的组件
@ -46,7 +44,6 @@ public class FormDesignerUI extends ComponentUI {
private FormDesigner designer;
private SelectionModel selectionModel;
private Rectangle2D.Double back_or_selection_rect = new Rectangle2D.Double(0, 0, 0, 0);
private WatermarkPainter watermarkPainter;
private float time;
public FormDesignerUI() {
@ -119,11 +116,8 @@ public class FormDesignerUI extends ComponentUI {
// 绘制水印
private void paintWatermark(Graphics2D g) {
WatermarkAttr watermark = ReportUtils.getWatermarkFromAttrMarkFile(designer.getTarget());
// 不要每次都 new 一个 WatermarkPainter
if (watermarkPainter == null || !ComparatorUtils.equals(watermarkPainter.getWatermark(), watermark)) {
watermarkPainter = new WatermarkPainter(watermark);
}
watermarkPainter.paint(g, 0, designer.getParaHeight(), designer.getArea().getBounds());
WatermarkPainter painter = WatermarkPainter.createPainter(watermark, designer.getResolution());
painter.paint(g, 0, designer.getParaHeight(), designer.getArea().getBounds());
}
private int[] getActualLine(int i) {

3
designer-realize/src/main/java/com/fr/design/webattr/EditReportServerParameterPane.java

@ -5,6 +5,7 @@ package com.fr.design.webattr;
import com.fr.base.ConfigManager;
import com.fr.base.print.PrintSettingsAttrMark;
import com.fr.config.PrintConfig;
import com.fr.config.ServerPreferenceConfig;
import com.fr.design.gui.frpane.LoadingBasicPane;
import com.fr.design.gui.frpane.UITabbedPane;
@ -109,7 +110,7 @@ public class EditReportServerParameterPane extends LoadingBasicPane {
jsPane.update(webAttr);
printSettings = printSettingPane.updateBean();
(ConfigManager.getProviderInstance()).getPrintAttr().setPrintSettings(printSettings);
PrintConfig.getInstance().setPrintSettings(printSettings);
reportServerPreferenceConfig.setErrorTemplate(this.errorTemplatePane.updateBean());
}

24
designer-realize/src/main/java/com/fr/grid/GridUI.java

@ -48,9 +48,20 @@ import com.fr.stable.script.CalculatorUtils;
import com.fr.stable.unit.FU;
import com.fr.third.antlr.ANTLRException;
import javax.swing.*;
import javax.swing.JComponent;
import javax.swing.UIManager;
import javax.swing.plaf.ComponentUI;
import java.awt.*;
import java.awt.AlphaComposite;
import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Composite;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Paint;
import java.awt.Rectangle;
import java.awt.Shape;
import java.awt.Stroke;
import java.awt.geom.Area;
import java.awt.geom.GeneralPath;
import java.awt.geom.Line2D;
@ -98,7 +109,6 @@ public class GridUI extends ComponentUI {
protected int resolution;
private boolean isAuthority = false;
private WatermarkPainter watermarkPainter;
public GridUI(int resolution) {
super();
@ -1104,12 +1114,8 @@ public class GridUI extends ComponentUI {
// 绘制水印
private void paintWatermark(Graphics2D g2d, FineBook book) {
WatermarkAttr watermark = ReportUtils.getWatermarkFromAttrMarkFile(book);
// 不要每次都 new 一个 WatermarkPainter
if (watermarkPainter == null || !ComparatorUtils.equals(watermarkPainter.getWatermark(), watermark)) {
watermarkPainter = new WatermarkPainter(watermark);
}
watermarkPainter.paint(g2d, gridSize.width, gridSize.height);
WatermarkPainter painter = WatermarkPainter.createPainter(watermark, resolution);
painter.paint(g2d, gridSize.width, gridSize.height);
}

10
designer-realize/src/main/java/com/fr/poly/PolyDesignUI.java

@ -10,7 +10,6 @@ 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;
@ -56,7 +55,6 @@ public class PolyDesignUI extends ComponentUI {
private PolyDesigner designer;
private int resolution;
private float time;
private WatermarkPainter watermarkPainter;
public PolyDesignUI(int resolution) {
if (resolution == 0){
@ -112,12 +110,8 @@ public class PolyDesignUI extends ComponentUI {
// 绘制水印
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);
WatermarkPainter painter = WatermarkPainter.createPainter(watermark, resolution);
painter.paint(g2d, width, height);
}
private void paintAddedData(Graphics g) {

Loading…
Cancel
Save