Browse Source

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

* commit '3be9208808791d8ef6cc54e96b1482ac806fe102':
  使用内部类代替重复的方法
  CHART-18139 修改富文本字段样式
research/10.0
superman 4 years ago
parent
commit
f39bf39e2e
  1. 31
      designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldButton.java

31
designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldButton.java

@ -3,9 +3,11 @@ package com.fr.van.chart.designer.component.richText;
import com.fr.base.BaseUtils;
import com.fr.data.util.function.DataFunction;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ibutton.UIButtonUI;
import com.fr.design.gui.ibutton.UIToggleButton;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.utils.gui.GUIPaintUtils;
import com.fr.plugin.chart.base.FirstFunction;
import com.fr.plugin.chart.base.format.AttrTooltipDurationFormat;
import com.fr.plugin.chart.base.format.AttrTooltipFormat;
@ -15,9 +17,12 @@ import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import javax.swing.Icon;
import javax.swing.JPanel;
import javax.swing.plaf.ButtonUI;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Graphics2D;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
@ -26,6 +31,7 @@ import java.text.Format;
public class VanChartFieldButton extends JPanel {
private static final Icon ADD_ICON = BaseUtils.readIcon("/com/fr/base/images/cell/control/add.png");
private static final Color HOVER_COLOR = new Color(232, 232, 232);
private static final int W = 200;
private static final int H = 24;
@ -134,9 +140,17 @@ public class VanChartFieldButton extends JPanel {
}
};
}
public ButtonUI getUI() {
return new FieldButtonUI();
}
};
addButton = new UIButton(ADD_ICON);
addButton = new UIButton(ADD_ICON) {
public ButtonUI getUI() {
return new FieldButtonUI();
}
};
addButton.addMouseListener(new MouseAdapter() {
@ -163,7 +177,7 @@ public class VanChartFieldButton extends JPanel {
double[] rowSize = {p};
double[] columnSize = {e, d};
JPanel content = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 0, 0);
JPanel content = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 3, 0);
content.setPreferredSize(new Dimension(W, H));
return content;
@ -172,4 +186,17 @@ public class VanChartFieldButton extends JPanel {
public void setSelectedState(boolean selected) {
fieldButton.setSelected(selected);
}
private static class FieldButtonUI extends UIButtonUI {
protected void doExtraPainting(UIButton b, Graphics2D g2d, int w, int h, String selectedRoles) {
if (isPressed(b) && b.isPressedPainted()) {
GUIPaintUtils.fillPressed(g2d, 0, 0, w, h, b.isRoundBorder(), b.getRectDirection(), b.isDoneAuthorityEdited(selectedRoles));
} else if (isRollOver(b)) {
GUIPaintUtils.fillRollOver(g2d, 0, 0, w, h, b.isRoundBorder(), b.getRectDirection(), b.isDoneAuthorityEdited(selectedRoles), b.isPressedPainted(), HOVER_COLOR);
} else if (b.isNormalPainted()) {
GUIPaintUtils.fillNormal(g2d, 0, 0, w, h, b.isRoundBorder(), b.getRectDirection(), b.isDoneAuthorityEdited(selectedRoles), b.isPressedPainted());
}
}
}
}

Loading…
Cancel
Save