Browse Source

Merge pull request #2736 in DESIGN/design from feature/10.0 to research/10.0

* commit '05c3d97ca4d1de917765fa2b3b29bd5dd82cc730':
  REPORT-42126 && REPORT-41929 && REPORT-41272【预定义样式】老jar下做的cpt模板,设置了单元格的样式,升级到最新,发现单元格预定义样式丢失了
  CHART-16440 甘特图项目轴面板
  修改魔法值问题
  更新
  REPORT-41503 修改代码错误
  REPORT-41503 【JDK11】设计器启动页面图标不清晰 【问题原因】Windows环境下,jdk11的缩放会造成绘制启动图片模糊 【改动思路】使用2倍图,然后用1倍图的尺寸绘制图片,再经过jdk11的缩放之后显示效果会好一些
research/10.0
superman 4 years ago
parent
commit
11a2135661
  1. 5
      designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java
  2. 28
      designer-base/src/main/java/com/fr/design/mainframe/predefined/info/PredefinedStyleInfoCollector.java
  3. 2
      designer-base/src/test/java/com/fr/design/mainframe/predefined/info/PredefinedStyleInfoCollectorTest.java
  4. 38
      designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/axis/GanttAxisStylePane.java
  5. 57
      designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/axis/GanttAxisStylePaneWithPosition.java
  6. 8
      designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/axis/GanttProcessAxisPane.java
  7. 75
      designer-realize/src/main/java/com/fr/start/common/SplashPane4WinAndJDK11.java
  8. 6
      designer-realize/src/main/java/com/fr/start/common/SplashWindow.java

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

@ -160,7 +160,7 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
private void setPredefinedInfo(boolean isNewFile){
if (this.template.getAttrMark(PredefinedStyleAttrMark.XML_TAG) == null) {
PredefinedStyleAttrMark attrMark = new PredefinedStyleAttrMark();
PredefinedStyleAttrMark attrMark = PredefinedStyleAttrMark.createDefaultStyleMark();
if (!isNewFile || !DesignUtils.checkDesignerRemoteVersion()) {
attrMark.setPreferenceStyleName(InterProviderFactory.getProvider().getLocText("Fine-Engine_Predefined_Style_Compatibility"));
}
@ -821,6 +821,7 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
if (editingFILE == null || editingFILE instanceof MemFILE) {
return false;
}
PredefinedStyleInfoCollector.getInstance().collectUseNumber(this.getTemplatePredefinedStyle());
try {
this.getTarget().setPredefinedStyleName(this.getTemplatePredefinedStyle(), false);
this.getTarget().export(editingFILE.asOutputStream());
@ -1370,7 +1371,7 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
public String getTemplatePredefinedStyle(){
PredefinedStyleAttrMark attrMark = this.getTarget().getAttrMark(PredefinedStyleAttrMark.XML_TAG);
if (attrMark == null){
attrMark = new PredefinedStyleAttrMark();
attrMark = PredefinedStyleAttrMark.createDefaultStyleMark();
}
return attrMark.getPreferenceStyleName();
}

28
designer-base/src/main/java/com/fr/design/mainframe/predefined/info/PredefinedStyleInfoCollector.java

@ -2,9 +2,11 @@ package com.fr.design.mainframe.predefined.info;
import com.fr.config.MarketConfig;
import com.fr.design.DesignerEnvManager;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.burying.point.AbstractPointCollector;
import com.fr.design.mainframe.template.info.SendHelper;
import com.fr.general.CloudCenter;
import com.fr.general.ComparatorUtils;
import com.fr.general.GeneralUtils;
import com.fr.json.JSONObject;
import com.fr.stable.xml.XMLPrintWriter;
@ -15,6 +17,9 @@ import com.fr.third.joda.time.DateTime;
* Created by kerry on 2020-09-04
*/
public class PredefinedStyleInfoCollector extends AbstractPointCollector {
//每三天上传一次
private static final long DELTA = 3 * 24 * 3600 * 1000L;
private static final String SIMPLE_DATE_PATTERN = "yyyy-MM-dd";
private static final String XML_TAG = "PredefinedStyleInfo";
private static final String XML_FILE_NAME = "predefinedStyle.info";
@ -31,6 +36,12 @@ public class PredefinedStyleInfoCollector extends AbstractPointCollector {
private static final String ATTR_CLICK_NUMBER = "clickNumber";
private static final String ATTR_USE_NUMBER = "useNumber";
private static final String ATTR_TIME = "time";
private static final String XML_LAST_TIME = "lastSendTime";
/**
* 上一次的发送时间
*/
private long lastSendTime;
private int clickNumber = 0;
@ -61,8 +72,11 @@ public class PredefinedStyleInfoCollector extends AbstractPointCollector {
saveInfo();
}
public void collectUseNumber() {
public void collectUseNumber(String predefinedName) {
if (!ComparatorUtils.equals(Toolkit.i18nText("Fine-Engine_Predefined_Style_Compatibility"), predefinedName) &&
!ComparatorUtils.equals(Toolkit.i18nText("Fine-Engine_Report_DEFAULT"), predefinedName)) {
useNumber++;
}
saveInfo();
}
@ -78,9 +92,15 @@ public class PredefinedStyleInfoCollector extends AbstractPointCollector {
@Override
public void sendPointInfo() {
if (System.currentTimeMillis() - lastSendTime < DELTA) {
return;
}
String content = generateTotalInfo();
SendHelper.sendSinglePointInfo(CLOUD_URL, content);
this.lastSendTime = System.currentTimeMillis();
this.clickNumber = 0;
this.useNumber = 0;
saveInfo();
}
public String generateTotalInfo() {
@ -105,6 +125,7 @@ public class PredefinedStyleInfoCollector extends AbstractPointCollector {
if (XML_TAG.equals(name)) {
this.clickNumber = reader.getAttrAsInt(ATTR_CLICK_NUMBER, 0);
this.useNumber = reader.getAttrAsInt(ATTR_USE_NUMBER, 0);
this.lastSendTime = reader.getAttrAsLong(XML_LAST_TIME, System.currentTimeMillis());
}
}
}
@ -112,7 +133,8 @@ public class PredefinedStyleInfoCollector extends AbstractPointCollector {
@Override
public void writeXML(XMLPrintWriter writer) {
writer.startTAG(XML_TAG);
writer.attr(ATTR_CLICK_NUMBER, this.clickNumber).attr(ATTR_USE_NUMBER, this.useNumber);
writer.attr(ATTR_CLICK_NUMBER, this.clickNumber).attr(ATTR_USE_NUMBER, this.useNumber)
.attr(XML_LAST_TIME, this.lastSendTime);
writer.end();
}
}

2
designer-base/src/test/java/com/fr/design/mainframe/predefined/info/PredefinedStyleInfoCollectorTest.java

@ -59,7 +59,7 @@ public class PredefinedStyleInfoCollectorTest {
@Test
public void testCollectUseNumber() {
PredefinedStyleInfoCollector.getInstance().collectUseNumber();
PredefinedStyleInfoCollector.getInstance().collectUseNumber("test");
Assert.assertEquals(1, PredefinedStyleInfoCollector.getInstance().getUseNumber());
}

38
designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/axis/GanttAxisStylePane.java

@ -23,22 +23,28 @@ public class GanttAxisStylePane extends BasicBeanPane<GanttAxisStyleAttr> {
private ColorSelectBoxWithOutTransparent colorSelectBox4button;
private UINumberDragPane transparent;
public ChartTextAttrPane getTextAttrPane() {
return textAttrPane;
}
public ColorSelectBoxWithOutTransparent getColorSelectBox4button() {
return colorSelectBox4button;
}
public UINumberDragPane getTransparent() {
return transparent;
}
public GanttAxisStylePane() {
textAttrPane = new ChartTextAttrPane();
colorSelectBox4button = new ColorSelectBoxWithOutTransparent(100);
transparent = new UINumberDragPane(0, 100);
initComponents();
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH;
double[] row = {p,p,p};
double[] row = {p, p, p, p};
double[] col = {f, e};
Component[][] components = new Component[][]{
new Component[]{textAttrPane, null},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Color")), colorSelectBox4button},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Alpha")), transparent}
};
Component[][] components = getUsedComponents();
JPanel content = TableLayoutHelper.createTableLayoutPane(components, row, col);
@ -46,6 +52,20 @@ public class GanttAxisStylePane extends BasicBeanPane<GanttAxisStyleAttr> {
this.add(content, BorderLayout.CENTER);
}
protected void initComponents() {
textAttrPane = new ChartTextAttrPane();
colorSelectBox4button = new ColorSelectBoxWithOutTransparent(100);
transparent = new UINumberDragPane(0, 100);
}
protected Component[][] getUsedComponents() {
return new Component[][]{
new Component[]{textAttrPane, null},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Color")), colorSelectBox4button},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Alpha")), transparent}
};
}
@Override
public void populateBean(GanttAxisStyleAttr contentAttr) {
textAttrPane.populate(contentAttr.getTextAttr());

57
designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/axis/GanttAxisStylePaneWithPosition.java

@ -0,0 +1,57 @@
package com.fr.van.chart.gantt.designer.style.axis;
import com.fr.base.BaseUtils;
import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.plugin.chart.gantt.attr.GanttAxisStyleAttr;
import com.fr.plugin.chart.gantt.attr.GanttAxisStyleAttrWithPosition;
import com.fr.stable.Constants;
import javax.swing.Icon;
import java.awt.Component;
/**
* @author Bjorn
* @version 10.0
* Created by Bjorn on 2020-10-27
*/
public class GanttAxisStylePaneWithPosition extends GanttAxisStylePane {
private UIButtonGroup<Integer> alignmentPane;
protected void initComponents() {
super.initComponents();
Icon[] alignmentIconArray = {BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_left_normal.png"),
BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_center_normal.png"),
BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_right_normal.png")};
Integer[] alignment = new Integer[]{Constants.LEFT, Constants.CENTER, Constants.RIGHT};
alignmentPane = new UIButtonGroup<>(alignmentIconArray, alignment);
}
protected Component[][] getUsedComponents() {
return new Component[][]{
new Component[]{getTextAttrPane(), null},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Color")), getColorSelectBox4button()},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Report_Alpha")), getTransparent()},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Form_BorderLayout_Constraints")), alignmentPane}
};
}
public void populateBean(GanttAxisStyleAttrWithPosition contentAttr) {
super.populateBean(contentAttr);
alignmentPane.setSelectedItem(contentAttr.getPosition());
}
public void updateBean(GanttAxisStyleAttrWithPosition contentAttr) {
super.updateBean(contentAttr);
contentAttr.setPosition(alignmentPane.getSelectedItem());
}
@Override
public GanttAxisStyleAttr updateBean() {
GanttAxisStyleAttrWithPosition styleAttr = new GanttAxisStyleAttrWithPosition();
updateBean(styleAttr);
return styleAttr;
}
}

8
designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/axis/GanttProcessAxisPane.java

@ -27,8 +27,8 @@ public class GanttProcessAxisPane extends AbstractVanChartScrollPane<VanChart> {
private UISpinner horizontalProportion;
private GanttAxisStylePane horizontalHeaderPane;
private GanttAxisStylePane verticalHeaderPane;
private GanttAxisStylePane bodyPane;
private GanttAxisStylePaneWithPosition verticalHeaderPane;
private GanttAxisStylePaneWithPosition bodyPane;
@Override
protected JPanel createContentPane() {
@ -54,7 +54,7 @@ public class GanttProcessAxisPane extends AbstractVanChartScrollPane<VanChart> {
}
private Component createBodyPane() {
bodyPane = new GanttAxisStylePane();
bodyPane = new GanttAxisStylePaneWithPosition();
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Content"), bodyPane);
}
@ -66,7 +66,7 @@ public class GanttProcessAxisPane extends AbstractVanChartScrollPane<VanChart> {
}
private Component createVerticalHeaderPane() {
verticalHeaderPane = new GanttAxisStylePane();
verticalHeaderPane = new GanttAxisStylePaneWithPosition();
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Vertical_Table"), verticalHeaderPane);
}

75
designer-realize/src/main/java/com/fr/start/common/SplashPane4WinAndJDK11.java

@ -0,0 +1,75 @@
package com.fr.start.common;
import com.bulenkov.iconloader.IconLoader;
import com.fr.base.BaseUtils;
import com.fr.design.locale.impl.SplashMark;
import com.fr.general.IOUtils;
import com.fr.general.locale.LocaleCenter;
import javax.swing.Icon;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
/**
* @author Yvan
* @version 10.0
* Created by Yvan on 2020/10/27
*/
public class SplashPane4WinAndJDK11 extends SplashPane{
/**
* 启动画面图片路径
*/
private final String imagePath;
/**
* 启动画面图片是否使用了两倍图
*/
private boolean isDouble = false;
private static final String IMAGE_SPLASH = "splash_10.png";
private static final String IMAGE_SPLASH_DOUBLE = "splash_10@2x.png";
public SplashPane4WinAndJDK11() {
this.imagePath = getSplashPath4WinAndJdk11();
}
private String getSplashPath4WinAndJdk11() {
String path = (String) LocaleCenter.getMark(SplashMark.class).getValue();
if (path.contains(IMAGE_SPLASH)) {
// 为图片加上"@2x"
String pathOfDouble = path.replace(IMAGE_SPLASH, IMAGE_SPLASH_DOUBLE);
// 某些定制jar里面没有两倍图,判断一下,如果文件不存在,就返回一倍图的path
if (IOUtils.readResource(pathOfDouble) != null) {
this.isDouble = true;
return pathOfDouble;
}
}
return path;
}
@Override
protected void paintComponent(Graphics g) {
if (!isDouble) {
super.paintComponent(g);
return;
}
BufferedImage image = BaseUtils.readImage(imagePath);
Graphics2D newG = (Graphics2D)g.create(0, 0, image.getWidth(), image.getHeight());
newG.scale(0.5D, 0.5D);
newG.drawImage(image, 0, 0, null);
newG.scale(1.0D, 1.0D);
newG.dispose();
paintShowText((Graphics2D) g);
g.dispose();
}
@Override
Dimension getSplashDimension() {
Icon icon = IconLoader.getIcon(imagePath);
return isDouble ? new Dimension(icon.getIconWidth() / 2, icon.getIconHeight() / 2) :
new Dimension(icon.getIconWidth(), icon.getIconHeight());
}
}

6
designer-realize/src/main/java/com/fr/start/common/SplashWindow.java

@ -1,6 +1,7 @@
package com.fr.start.common;
import com.fr.design.fun.OemProcessor;
import com.fr.design.jdk.JdkVersion;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.IOUtils;
import com.fr.log.FineLoggerFactory;
@ -31,7 +32,12 @@ public class SplashWindow extends JFrame {
initTitleIcon();
//slash pane
// 如果是Windows + JDK版本大于等于9时,一倍图启动会很模糊,这边使用两倍图
if (OperatingSystem.isWindows() && JdkVersion.GE_9.support()) {
this.splash = new SplashPane4WinAndJDK11();
} else {
this.splash = new SplashPane();
}
splash.setBackground(null);
this.setContentPane(splash);

Loading…
Cancel
Save