Browse Source

Merge branch 'feature/x' of ssh://code.fineres.com:7999/~kerry/design_10.0 into feature/x

feature/x
kerry 3 years ago
parent
commit
a1c88fd6c3
  1. 2
      designer-base/src/main/java/com/fr/design/actions/community/BugAction.java
  2. 2
      designer-base/src/main/java/com/fr/design/actions/community/NeedAction.java
  3. 23
      designer-base/src/main/java/com/fr/design/cell/CellRectangleStylePreviewPane.java
  4. 45
      designer-base/src/main/java/com/fr/design/cell/CellStylePreviewPane.java
  5. 20
      designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/ColorBackgroundQuickPane.java
  6. 7
      designer-base/src/main/java/com/fr/design/mainframe/theme/ThemedCellStyleListPane.java
  7. 26
      designer-chart/src/main/java/com/fr/van/chart/config/DefaultStyleConstants.java
  8. 15
      designer-form/src/main/java/com/fr/design/mainframe/share/action/CreateComponentAction.java

2
designer-base/src/main/java/com/fr/design/actions/community/BugAction.java

@ -17,7 +17,7 @@ public class BugAction extends AbstractDesignerSSO {
@Override
public String getJumpUrl() {
return CloudCenter.getInstance().acquireUrlByKind("bbs.bugs", "https://service.fanruan.com/PF/FR/feedback");
return CloudCenter.getInstance().acquireUrlByKind("bbs.bugs", "https://service.fanruan.com/PF/FR/feedback?type=2");
}
public static final MenuKeySet BUG = new MenuKeySet() {

2
designer-base/src/main/java/com/fr/design/actions/community/NeedAction.java

@ -18,7 +18,7 @@ public class NeedAction extends AbstractDesignerSSO {
@Override
public String getJumpUrl() {
return CloudCenter.getInstance().acquireUrlByKind("bbs.needs", "https://service.fanruan.com/PF/FR/feedback");
return CloudCenter.getInstance().acquireUrlByKind("bbs.needs", "https://service.fanruan.com/PF/FR/feedback?type=1");
}
public static final MenuKeySet NEED = new MenuKeySet() {

23
designer-base/src/main/java/com/fr/design/cell/CellRectangleStylePreviewPane.java

@ -73,7 +73,26 @@ public class CellRectangleStylePreviewPane extends JPanel {
}
@Override
public Dimension getMinimumSize() {
return getPreferredSize();
public void setPreferredSize(Dimension preferredSize) {
super.setPreferredSize(preferredSize);
int hw = preferredSize.width / 2;
int hh = preferredSize.height / 2;
cellStylePreviewPaneGrid[0][0].setPreferredSize(new Dimension(hw, hh));
cellStylePreviewPaneGrid[0][1].setPreferredSize(new Dimension(hw, hh));
cellStylePreviewPaneGrid[1][0].setPreferredSize(new Dimension(hw, hh));
cellStylePreviewPaneGrid[1][1].setPreferredSize(new Dimension(hw, hh));
}
@Override
public Dimension getPreferredSize() {
Dimension d00 = cellStylePreviewPaneGrid[0][0].getPreferredSize();
Dimension d01 = cellStylePreviewPaneGrid[0][1].getPreferredSize();
Dimension d10 = cellStylePreviewPaneGrid[1][0].getPreferredSize();
Dimension d11 = cellStylePreviewPaneGrid[1][1].getPreferredSize();
int width = Math.max(d00.width + d01.width, d10.width + d11.width);
int height = Math.max(d00.height + d10.height, d01.height + d11.height);
return new Dimension(width, height);
}
}

45
designer-base/src/main/java/com/fr/design/cell/CellStylePreviewPane.java

@ -1,19 +1,26 @@
package com.fr.design.cell;
import com.fr.base.BaseUtils;
import com.fr.base.GraphHelper;
import com.fr.base.NameStyle;
import com.fr.base.ScreenResolution;
import com.fr.base.Style;
import com.fr.general.FRFont;
import com.fr.general.IOUtils;
import com.fr.stable.unit.PT;
import javax.swing.JPanel;
import java.awt.AlphaComposite;
import java.awt.Color;
import java.awt.Composite;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import java.awt.image.BufferedImage;
import java.util.List;
/**
* @author Starryi
@ -22,6 +29,7 @@ import java.awt.image.BufferedImage;
*/
public class CellStylePreviewPane extends JPanel {
public static final int MINIMUM_HEIGHT = 40;
private static final BufferedImage transparentBackgroundImage = IOUtils.readImage("/com/fr/design/images/transparent_background.png");
private final float transparentBackgroundWidth;
private final float transparentBackgroundHeight;
@ -31,6 +39,7 @@ public class CellStylePreviewPane extends JPanel {
public CellStylePreviewPane() {
transparentBackgroundWidth = transparentBackgroundImage.getWidth(null);
transparentBackgroundHeight = transparentBackgroundImage.getHeight(null);
setPreferredSize(new Dimension(0, 0));
}
public void setPaintText(String paintText) {
@ -118,7 +127,39 @@ public class CellStylePreviewPane extends JPanel {
}
@Override
public Dimension getMinimumSize() {
return getPreferredSize();
public Dimension getPreferredSize() {
Dimension size = super.getPreferredSize();
int width = size.width;
int height = size.height;
if (height != 0) {
// 使用者设置了一个高度
return size;
} else if (width == 0) {
// 使用者未设置任何尺寸
return new Dimension(width, MINIMUM_HEIGHT);
} else {
// 使用者设置了宽度,但未设置高度
return getAutoWrapContentPreferredSize(width, height);
}
}
private Dimension getAutoWrapContentPreferredSize(int width, int height) {
int resolution = ScreenResolution.getScreenResolution();
// 计算文本区域高度
final FRFont frFont = style.getFRFont();
final Font rfont = frFont.applyResolutionNP(resolution);
final FontMetrics metrics = GraphHelper.getFontMetrics(rfont);
final int textLineHeight = metrics.getHeight();
final double textLineSpacing = PT.pt2pix(style.getLineSpacing(), resolution);
List textLineList = BaseUtils.getLineTextList(paintText, style, rfont, height, width, resolution);
double textLinesHeight = textLineList.size() * textLineHeight + Math.max(0, textLineList.size() - 1) * textLineSpacing;
height = (int) Math.max(MINIMUM_HEIGHT, textLinesHeight);
return new Dimension(width, height);
}
}

20
designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/ColorBackgroundQuickPane.java

@ -19,7 +19,17 @@ public class ColorBackgroundQuickPane extends BackgroundQuickPane {
public ColorBackgroundQuickPane() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
colorSelectBox = new NewColorSelectBox(100);
colorSelectBox = new NewColorSelectBox(100) {
@Override
public boolean shouldResponseChangeListener() {
// ColorBackgroundQuickPane注册监听器ChangeListenerImpl的逻辑不能丢,因为里面有修改字段backgroundChange的逻辑.
// 所以在监听器重复注册以及UndoState重复生成时,应该保留ChangeListenerImpl, 而放弃NewColorSelectBox内部自己注册
// ChangeListener
// REPORT-63760 【主题切换】撤销以后,样式设置有问题
// REPORT-64006 【模板主题】单元格自定义样式背景色设置不生效
return false;
}
};
this.add(colorSelectBox, BorderLayout.NORTH);
}
@ -41,14 +51,10 @@ public class ColorBackgroundQuickPane extends BackgroundQuickPane {
}
@Override
public boolean shouldResponseChangeListener() {
// NewColorSelectBox实现了UIObserver接口,这里就不要重复注册监听器了,以避免产生重复UndoState.
return false;
public void registerChangeListener(final UIObserverListener listener) {
this.colorSelectBox.addSelectChangeListener(new ChangeListenerImpl(listener));
}
@Override
public void registerChangeListener(final UIObserverListener listener) { }
@Override
/**
* 是否为ColorBackground 类型

7
designer-base/src/main/java/com/fr/design/mainframe/theme/ThemedCellStyleListPane.java

@ -149,7 +149,6 @@ public class ThemedCellStyleListPane extends FurtherBasicBeanPane<ThemedCellStyl
super();
setLayout(new BorderLayout(5, 0));
setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 0));
setPreferredSize(new Dimension(getPreferredSize().width, 80));
button = new UIRadioButton();
button.setBorder(BorderFactory.createEmptyBorder());
previewArea = new CellRectangleStylePreviewPane();
@ -162,6 +161,12 @@ public class ThemedCellStyleListPane extends FurtherBasicBeanPane<ThemedCellStyl
button.setSelected(isSelected);
previewArea.setPlainText(value.getName());
previewArea.setStyle(value.getStyle(), value.getCellBorderStyle());
int preferredWidth = list.getWidth() - 15 - button.getPreferredSize().width;
preferredWidth = Math.max(0, preferredWidth);
int preferredHeight = 0;
previewArea.setPreferredSize(new Dimension(preferredWidth, preferredHeight));
return this;
}
}

26
designer-chart/src/main/java/com/fr/van/chart/config/DefaultStyleConstants.java

@ -18,35 +18,35 @@ import java.awt.Font;
* Created by shine on 2021/6/25
*/
public class DefaultStyleConstants {
static final FRFont TITLE = FRFont.getInstance(ChartBaseUtils.getLocalDefaultFont("Microsoft YaHei"), Font.BOLD, 14, new Color(241, 246, 255));
static final FRFont LEGEND = FRFont.getInstance(ChartBaseUtils.getLocalDefaultFont("Microsoft YaHei"), Font.PLAIN, 9, new Color(159, 173, 191));
static final FRFont TITLE = FRFont.getInstance(ChartBaseUtils.getLocalDefaultFont("Microsoft YaHei"), Font.BOLD, 19, new Color(241, 246, 255));
static final FRFont LEGEND = FRFont.getInstance(ChartBaseUtils.getLocalDefaultFont("Microsoft YaHei"), Font.PLAIN, 12, new Color(159, 173, 191));
static final FRFont AXIS_LABEL = FRFont.getInstance(ChartBaseUtils.getLocalDefaultFont("Microsoft YaHei"), Font.PLAIN, 9, new Color(159, 173, 191));
static final FRFont AXIS_TITLE = FRFont.getInstance(ChartBaseUtils.getLocalDefaultFont("Microsoft YaHei"), Font.PLAIN, 9, new Color(200, 211, 228));
static final FRFont AXIS_LABEL = FRFont.getInstance(ChartBaseUtils.getLocalDefaultFont("Microsoft YaHei"), Font.PLAIN, 12, new Color(159, 173, 191));
static final FRFont AXIS_TITLE = FRFont.getInstance(ChartBaseUtils.getLocalDefaultFont("Microsoft YaHei"), Font.PLAIN, 12, new Color(200, 211, 228));
static final Color AXIS_LINE = new Color(46, 75, 102);
static final Color GRID_LINE = new Color(30, 55, 78);
static final FRFont ALERT_FONT = FRFont.getInstance(ChartBaseUtils.getLocalDefaultFont("Microsoft YaHei"), Font.PLAIN, 9, new Color(255, 0, 0));
static final FRFont ALERT_FONT = FRFont.getInstance(ChartBaseUtils.getLocalDefaultFont("Microsoft YaHei"), Font.PLAIN, 12, new Color(255, 0, 0));
static final FRFont DATA_SHEET = FRFont.getInstance(ChartBaseUtils.getLocalDefaultFont("Microsoft YaHei"), Font.PLAIN, 9, new Color(159, 173, 191));
static final FRFont DATA_SHEET = FRFont.getInstance(ChartBaseUtils.getLocalDefaultFont("Microsoft YaHei"), Font.PLAIN, 12, new Color(159, 173, 191));
static final Color DATA_SHEET_BORDER = new Color(46, 75, 102);
static final Color BORDER = Color.BLACK;
static final int BORDER_WIDTH = Constants.LINE_NONE;
static final int SPECIAL_BORDER_WIDTH = Constants.LINE_THIN;
static final FRFont PIE_CATEGORY_LABEL = FRFont.getInstance(ChartBaseUtils.getLocalDefaultFont("Microsoft YaHei"), Font.PLAIN, 10, new Color(232, 232, 232));
static final FRFont PIE_CATEGORY_LABEL = FRFont.getInstance(ChartBaseUtils.getLocalDefaultFont("Microsoft YaHei"), Font.PLAIN, 13, new Color(232, 232, 232));
static final Color GAUGE_PANE_BACK_COLOR = null;
static final Color GAUGE_HINGE = null;
static final Color GAUGE_PANE_BACK_COLOR_4_RING = new Color(72, 73, 79);
static final Color GAUGE_SLOT_BACKGROUND_COLOR = new Color(72, 73, 79);
private static final String FONT_NAME = ChartBaseUtils.getLocalDefaultFont("verdana");
static final FRFont THERMOMETER_LABEL_FONT = FRFont.getInstance(FONT_NAME, Font.BOLD, 9, new Color(232, 232, 232));//试管仪表盘标签的默认样式
static final FRFont THERMOMETER_AXIS_LABEL = FRFont.getInstance(FONT_NAME, Font.PLAIN, 8, new Color(159, 173, 191));
static final FRFont THERMOMETER_LABEL_FONT = FRFont.getInstance(FONT_NAME, Font.BOLD, 12, new Color(232, 232, 232));//试管仪表盘标签的默认样式
static final FRFont THERMOMETER_AXIS_LABEL = FRFont.getInstance(FONT_NAME, Font.PLAIN, 11, new Color(159, 173, 191));
static final FRFont RING_VALUE_LABEL_FONT = FRFont.getInstance(FONT_NAME, Font.PLAIN, ChartConstants.AUTO_FONT_SIZE, new Color(232, 232, 232));//百分比圆环仪表盘值标签的默认样式
static final FRFont POINTER_VALUE_LABEL_FONT = FRFont.getInstance(FONT_NAME, Font.PLAIN, ChartConstants.AUTO_FONT_SIZE, new Color(232, 232, 232));//多指针仪表盘值标签的默认样式
static final FRFont POINTER_CATE_LABEL_FONT = FRFont.getInstance(FONT_NAME, Font.PLAIN, 10, new Color(232, 232, 232));//多指针仪表盘分类标签的默认样式
static final FRFont POINTER_CATE_LABEL_FONT = FRFont.getInstance(FONT_NAME, Font.PLAIN, 13, new Color(232, 232, 232));//多指针仪表盘分类标签的默认样式
static final Color MAP_NULL_VALUE_COLOR = new Color(168, 168, 168);
static final Color MAP_BORDER = Color.BLACK;
@ -56,12 +56,6 @@ public class DefaultStyleConstants {
static final Color DRILL_MAP_DRILL_TOOLS_BACK = Color.BLACK;
static final float DRILL_MAP_DRILL_TOOLS_BACK_OPACITY = 0.8f;
//todo vancharts
private static final Color GANTT_OUT_LINE = GRID_LINE;
private static final FRFont GANTT_LABEL = FRFont.getInstance(ChartBaseUtils.getLocalDefaultFont("Microsoft YaHei"), Font.PLAIN, 8, new Color(217, 217, 217));
private static final Color GANTT_BORDER_LINE = new Color(30, 36, 58);
private static final Color GAUGE_TICK = new Color(39, 49, 71);
static final Background BACK = null;
//新特新

15
designer-form/src/main/java/com/fr/design/mainframe/share/action/CreateComponentAction.java

@ -10,7 +10,9 @@ import com.fr.data.impl.NameTableData;
import com.fr.data.impl.TableDataDictionary;
import com.fr.design.actions.UpdateAction;
import com.fr.design.data.DesignTableDataManager;
import com.fr.design.designer.creator.XChartEditor;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XWTitleLayout;
import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.dialog.FineJOptionPane;
@ -56,8 +58,10 @@ import javax.swing.Action;
import javax.swing.UIManager;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.Insets;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import java.awt.image.BufferedImage;
@ -263,6 +267,17 @@ public class CreateComponentAction extends UpdateAction {
g2d.setColor(Color.WHITE);
g2d.fillRect(0, 0 , rect.width, rect.height);
comp.paint(im.getGraphics());
if (comp instanceof XWTitleLayout) {
XCreator body = ((XWTitleLayout) comp).getBodyCreator();
if (body instanceof XChartEditor) {
XChartEditor chartEditor = (XChartEditor) body;
Dimension size = chartEditor.getSize();
BufferedImage chartImage = new BufferedImage(size.width, size.height, BufferedImage.TYPE_INT_ARGB);
Insets margin = chartEditor.getInsets();;
chartEditor.getDesignerEditor().paintEditor(chartImage.getGraphics(), size, margin);
im.getGraphics().drawImage(chartImage, 0, chartEditor.getY(), null);
}
}
return im;
}

Loading…
Cancel
Save